这是基于此answer进行的跟踪.
$ls service/target/
classes lib maven-status surefire-reports
classes.-1194128992.timestamp maven-archiver service-1.0-SNAPSHOT.jar
并且在其中lib看起来像
$ls service/target/lib/
activation-1.1.jar akka-http-spray-json-experimental_2.11-1.0.jar mail-1.4.7.jar scala-reflect-2.11.2.jar
akka-actor_2.11-2.3.12.jar akka-parsing-experimental_2.11-1.0.jar manager-1.0-SNAPSHOT.jar scala-xml_2.11-1.0.2.jar
akka-http-core-experimental_2.11-1.0.jar akka-stream-experimental_2.11-1.0.jar reactive-streams-1.0.0.jar scalatest_2.11-2.2.5.jar
akka-http-experimental_2.11-1.0.jar config-1.2.1.jar
作为mvn全新安装的一部分,我希望将my-deployment-artifact捆绑在一起,看起来应该包含
service-1.0-SNAPSHOT.jar
lib/* (all the jars here)
如何将其创建为tar或.tar.gz,并使用mvn clean install进行生产?
解决方法:
您可以使用maven-assembly-plugin完成该任务.
在src / assembly / distribution.xml中创建程序集定义文件
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>distribution</id>
<formats>
<format>tar</format>
</formats>
<files>
<file>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
</file>
</files>
<fileSets>
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>lib</outputDirectory>
</fileSet>
</fileSets>
</assembly>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<descriptor>${project.basedir}/src/assembly/distribution.xml</descriptor>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
更多格式文件或自定义Maven-assembly-plugin可以在这里找到:https://maven.apache.org/plugins/maven-assembly-plugin/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。