将项目打包

 

将下图所展示的项目打包步骤:

 

1.在pom.xml文件中写入:

<groupId>com.dhcc</groupId>
<artifactId>dhcc-comment</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

PS:如果要打war包这里配置成:
<packaging>war</packaging>

2.执行maven-clean和maven-install,将项目打包,并放入本地仓库中。

 

PS:如果只是打包,不需要放至本地仓库中的话就改执行maven-package命令。

3.执行maven-install后,在其他项目的POM.XML中可以引用此jar包。

<dependency>
<groupId>com.dhcc</groupId>
<artifactId>dhcc-comment</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>



需要打包的项目pom.xml中添加:

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.dhccmachbusiness.dhccmachbusiness.DhccMachbusinessApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>


posted on 2018-01-23 15:12  SailorMoon  阅读(187)  评论(0编辑  收藏  举报