child <modelVersion>4.0.0</modelVersion> Now the maven version is forced to use 4.0.0 <groupId>com.xiangsoft.easy</groupId> <artifactId>easy-parent</artifactId> <version>1.0.1< /version> Here indicates that the parent is version 1.0.1 <packaging>pom</packaging> <name>easy-parent</name> <modules> <module>easy-inbound</module> Here indicates that the child has an easy-inbound Modules </modules> easy-inbound.pom <modelVersion>4.0.0</modelVersion> <groupId>com. xiangsoft.easy</groupId> <artifactId>easy-inbound</artifactId>
<version>2.1.1</version> This is the version of the child module, which will be placed in its own library during install. The version is 2.1.1, and what it depends on will be specified in the <parent> block below
. packaging>jar</packaging>
<name>easy-inbound</name>
<parent>
<groupId>com.xiangsoft.easy</groupId>
<artifactId>easy-parent</artifactId>
<version>1.0.1</ version> > The parent version that the child module depends on is 1.0.1
</parent>
Note that there is also a plugin that can package source code, and this packaging method is to cleanly package its own piece of code, unlike other packaging. Type all classes into a jar at once, such as
quote
<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>
In eclipse, if a jar package that is not in the local library is referenced, but a project of the specified maven version that has been defined by eclipse, it can also be compiled by maven, and it will use the project in eclipse for project association code association, and If it is the code and version of the local library, the code in the library will be used directly