栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

pom.xml文件中dependency中optional属性的作用

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pom.xml文件中dependency中optional属性的作用

optional
adj.
可选择的;选修的。

当project-A 依赖project-B, project-B 依赖project-C时

如果在B的pom.xml中将依赖C的optional指定为true

sample.ProjectC

ProjectC

1.0-SNAPSHOT

true

project-A中如果没有显式的手动引入project-C, 则project-A不会依赖project-C, 即project-A可以自己选择是否依赖project-C

如果不在B中配置依赖C的optional树形为true,则默认值为false, 此时A会自动依赖C。

项目springdataredis的pom.xml,我们引入了spring-data-redis这个dependency.

  


    org.springframework.data
    spring-data-redis
    2.7.0

我们看到jedis和lettuce均有optional为true的标示,所以我们需要自己引入选择使用哪个redis的驱动。




	4.0.0

	org.springframework.data
	spring-data-redis
	2.7.0

	Spring Data Redis
	Spring Data module for Redis
	https://spring.io/projects/spring-data-redis

	
		org.springframework.data.build
		spring-data-parent
		2.7.0
	

	
		2.7.0
		4.0.2
		1.1
		1.9.4
		1.4.19
		2.11.1
		6.1.8.RELEASE
		3.8.0
		1.01
		4.1.72.Final
		spring.data.redis
	

	
		scm:git:https://github.com/spring-projects/spring-data-redis.git
		scm:git:git@github.com:spring-projects/spring-data-redis.git
		https://github.com/spring-projects/spring-data-redis
	

	
		GitHub
		https://github.com/spring-projects/spring-data-redis/issues
	

	
		

			
				org.apache.commons
				commons-pool2
				${pool}
			

		
	

	

		

		
			org.springframework.data
			spring-data-keyvalue
			${springdata.keyvalue}
		

		
			org.springframework
			spring-tx
		

		
			org.springframework
			spring-oxm
		

		
			org.springframework
			spring-aop
		

		
			org.springframework
			spring-context-support
		

		

		
			redis.clients
			jedis
			${jedis}
			true
		

		
			io.lettuce
			lettuce-core
			${lettuce}
			true
		

		
			io.netty
			netty-transport-native-epoll
			linux-x86_64
			${netty}
			test
		

		
			io.netty
			netty-transport-native-kqueue
			osx-x86_64
			${netty}
			test
		

		
		
			io.projectreactor
			reactor-core
			true
		

		

		
			com.fasterxml.jackson.core
			jackson-core
			true
		

		
			com.fasterxml.jackson.datatype
			jackson-datatype-jsr310
			true
		

		
			com.fasterxml.jackson.core
			jackson-databind
			true
		

		
			commons-beanutils
			commons-beanutils
			${beanutils}
			true
		

		

		
			org.apache.commons
			commons-pool2
			true
		

		
		
		
			org.apache.geronimo.specs
			geronimo-jcdi_2.0_spec
			1.0.1
			test
		

		
			javax.interceptor
			javax.interceptor-api
			1.2.1
			test
		

		
			javax.enterprise
			cdi-api
			${cdi}
			provided
			true
		

		
			javax.annotation
			javax.annotation-api
			${javax-annotation-api}
			test
		

		
			org.apache.openwebbeans
			openwebbeans-se
			${webbeans}
			test
		

		
		
			org.jetbrains.kotlin
			kotlin-stdlib
			true
		

		
			org.jetbrains.kotlin
			kotlin-reflect
			true
		

		
			org.jetbrains.kotlinx
			kotlinx-coroutines-core
			${kotlin-coroutines}
			true
		

		
			org.jetbrains.kotlinx
			kotlinx-coroutines-reactor
			${kotlin-coroutines}
			true
		

		
			io.mockk
			mockk
			${mockk}
			test
		

		

		
			org.springframework
			spring-jdbc
			test
		

		
			org.awaitility
			awaitility
			${awaitility}
			test
		

		
			javax.transaction
			jta
			${jta}
			test
		

		
			javax.annotation
			jsr250-api
			1.0
			test
		

		
			com.thoughtworks.xstream
			xstream
			${xstream}
			test
		

		
			edu.umd.cs.mtc
			multithreadedtc
			${multithreadedtc}
			test
		

		
			io.projectreactor
			reactor-test
			test
		
	

	
		

			
				org.apache.maven.plugins
				maven-surefire-plugin
				
					
					-XX:-OmitStackTraceInFastThrow
					false
					
						***Test.java
					
				
			

			
				org.apache.maven.plugins
				maven-assembly-plugin
			

			
				org.asciidoctor
				asciidoctor-maven-plugin
				
					
						${lettuce}
						${jedis}
					
				
			

		
	

	
		
			spring-libs-release
			https://repo.spring.io/libs-release
		
	

	
		
			spring-plugins-release
			https://repo.spring.io/plugins-release
		
	

	
		
			
			none
		
	

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/995630.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号