1.parent -->pom.xmljava
<?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.tesst</groupId> <artifactId>parent</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>parent</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project-sourceEncoding>UTF-8</project-sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> </properties> <modules> <module>person</module> </modules> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <finalName>parent</finalName> <descriptors> <descriptor>package.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> </execution> </executions> </plugin> </plugins> </build> <repositories> <repository> <id>aliyun-repos</id> <name>aliyun Repository</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </repository> <repository> <id>jeecg</id> <name>jeecg Repository</name> <url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>jeecg-snapshots</id> <name>jeecg-snapshots Repository</name> <url>http://maven.jeecg.org/nexus/content/repositories/snapshots</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>java-repos</id> <name>Java Repository</name> <url>http://download.java.net/maven/2/</url> </repository> <repository> <id>springsource-repos</id> <name>SpringSource Repository</name> <url>http://repo.spring.io/release/</url> </repository> <repository> <id>central-repos</id> <name>Central Repository</name> <url>http://repo.maven.apache.org/maven2</url> </repository> <repository> <id>central-repos2</id> <name>Central Repository 2</name> <url>http://repo1.maven.org/maven2/</url> </repository> <repository> <id>activiti-repos</id> <name>Activiti Repository</name> <url>https://maven.alfresco.com/nexus/content/groups/public</url> </repository> <repository> <id>activiti-repos2</id> <name>Activiti Repository 2</name> <url>https://app.camunda.com/nexus/content/groups/public</url> </repository> <repository> <id>thinkgem-repos2</id> <name>ThinkGem Repository 2</name> <url>https://raw.github.com/thinkgem/repository/master</url> </repository> </repositories> <!-- 設定插件倉庫 --> <pluginRepositories> <!-- 若有Nexus私服, 取消註釋並指向正確的服務器地址. --> <pluginRepository> <id>aliyun-repos</id> <name>aliyun Repository</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </pluginRepository> </pluginRepositories> </project>
parent --> package.xmlgit
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id></id> <formats> <format>tar.gz</format> <format>dir</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>person/target/parent/</directory> <includes> <include>**/*.*</include> </includes> <outputDirectory>parent</outputDirectory> </fileSet> </fileSets> </assembly>
2.person -->pom.xmlgithub
<?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.tesst</groupId> <artifactId>parent</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>com.tesst</groupId> <artifactId>person</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>person</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <!-- assembly plugin --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptors> <descriptor>package.xml</descriptor> </descriptors> <finalName>parent</finalName> </configuration> <executions> <execution> <id>dwzip</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
person --> package.xmlspring
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> <id></id> <formats> <format>dir</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <directory>target/</directory> <includes> <include>person-0.0.1-SNAPSHOT.jar</include> </includes> <outputDirectory>plugin/writer/adswriter</outputDirectory> </fileSet> </fileSets> <dependencySets> <dependencySet> <useProjectArtifact>false</useProjectArtifact> <outputDirectory>plugin/writer/adswriter/libs</outputDirectory> <scope>runtime</scope> </dependencySet> </dependencySets> </assembly>
3.編譯:apache
進入parent目錄下, 執行 服務器
mvn -U clean package assembly:assembly -Dmaven.test.skip=true
打包成功,日誌顯示以下:app
[INFO] BUILD SUCCESS [INFO] ----------------------------------------------------------------- [INFO] Total time: 08:12 min [INFO] Finished at: 2015-12-13T16:26:48+08:00 [INFO] Final Memory: 133M/960M [INFO] -----------------------------------------------------------------