java打包

pom文件加

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</build>

resource文件夹下加
assembly.xml

<assembly>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>/lib</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<!--${env} 可以获取打包命令里的参数-->
<directory>src/main/resources/${env}/</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.xml</include>
<include>*.properties</include>
<include>*.yml</include>
<include>*.yaml</include>
<include>*.sh</include>
<include>*.bat</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/resources</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.xml</include>
<include>*.properties</include>
<include>*.yml</include>
<include>*.yaml</include>
<include>*.sh</include>
<include>*.bat</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>


posted @ 2018-12-05 16:13  金州恶汉拉文  阅读(141)  评论(0编辑  收藏  举报