maven使用一个小技巧(排除不同兄弟依赖中版本的不同的问题)
在项目中的POM文件如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!---关于项目的唯一标示-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.unutrip.vacation</groupId>
<artifactId>unutrip-vacation-web</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>unutrip-vacation-web</name><!---关于项目的唯一标示-->
<parent>
<groupId>com.unutrip</groupId>
<artifactId>unutrip-web-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent><!---关于项目的依赖jar--> <dependencies>
<dependency>
<groupId>com.unutrip.vacation</groupId>
<artifactId>unutrip-vacation-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency><!----定义公共的项目中在类库中排除json类库(org.json)--->
<dependency>
<groupId>com.unutrip.common</groupId>
<artifactId>unutrip-common-service</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</exclusion>
</exclusions>
</dependency><!----定义项目中在依赖的类库json类库(net.sf.json-lib)--->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.3</version>
<classifier>jdk15</classifier>
</dependency>
</dependencies><build>
<!--formaven/hudsonpackage定义项目的终极名称-->
<finalName>vacation</finalName><plugins>
<!--formvneclipse:myeclipse(.mymetadatacontext-root)-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration><!-----定义项目war的上下文名称--->
<warContextRoot>vacation</warContextRoot>
</configuration></plugin>
</plugins>
</build>
</project>