child里面的
easy-parent.pom
<modelVersion>4.0.0</modelVersion> 现在maven版本都是强制用4.0.0的
<groupId>com.xiangsoft.easy</groupId>
<artifactId>easy-parent</artifactId>
<version>1.0.1</version> 这里表示parent 是版本1.0.1
<packaging>pom</packaging>
<name>easy-parent</name>
<modules>
<module>easy-inbound</module> 这里表示child有一个 easy-inbound的模块
</modules>
easy-inbound.pom
<modelVersion>4.0.0</modelVersion>
<groupId>com.xiangsoft.easy</groupId>
<artifactId>easy-inbound</artifactId>
<version>2.1.1</version> 这是child 模块的版本,在install的时候会放到自己的库中, 版本呈现是2.1.1, 而他所依赖的会在下面<parent> 块中指定
<packaging>jar</packaging>
<name>easy-inbound</name>
<parent>
<groupId>com.xiangsoft.easy</groupId>
<artifactId>easy-parent</artifactId>
<version>1.0.1</version> > child 模块所依赖的parent 版本是 1.0.1
</parent>
注意里面还有能打包source code的plugin , 并且这个打包方式是只干净的打包自己的那块代码 , 不象其他的打包会一股脑 打入所有的class 到一个jar , 如
引用
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>wang.manager.BuildTool</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
在eclipse中 , 如果引用了 本地库中没有的jar包 , 但是 eclipse已经定义过的 指定的maven 版本的项目, 那 也可以maven编译通过, 并且 他会拿eclipse中的 项目 进行项目关联 代码关联,而如果是 本地库有的 代码 和 版本 , 则会直接用 库中的代码