<!-- redis star -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.7.4.RELEASE</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.7.1</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- redis end -->
1. 项目间传递
如果我的当前项目是project1,project1要依赖project2,project1依赖project2的配置中加上<optional>true</optional>,表示依赖可选,
Java代码 收藏代码
<dependency>
<groupId>com.projecct</groupId>
<artifactId>project2</artifactId>
<version>1.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
那么以后所有声明依赖project1的项目如果也依赖project2,就必须写手动声明。比如project3依赖project1和project2,如果project3只声明了对project1的依赖,那么project2不会自动加入依赖,需要重新声明对project2的依赖。
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.7.4.RELEASE</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.7.1</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- redis end -->
1. 项目间传递
如果我的当前项目是project1,project1要依赖project2,project1依赖project2的配置中加上<optional>true</optional>,表示依赖可选,
Java代码 收藏代码
<dependency>
<groupId>com.projecct</groupId>
<artifactId>project2</artifactId>
<version>1.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
那么以后所有声明依赖project1的项目如果也依赖project2,就必须写手动声明。比如project3依赖project1和project2,如果project3只声明了对project1的依赖,那么project2不会自动加入依赖,需要重新声明对project2的依赖。