我正在使用maven程序集插件包装胖子罐,然后要将胖子罐放入tar.gz包中,该包也由mvn-assembly插件生成。
问题是汇编程序不会将胖子jar放到tar文件中,而是放了一个小jar,它只包含代码,而没有依赖项。
这是我的pom文件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<descriptor>src/main/resources-local/assembly.xml</descriptor>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>my.App</mainClass>
</manifest>
</archive>
<outputDirectory>output</outputDirectory>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
和assembly.xml:
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*:project:*:*</include>
</includes>
<useProjectArtifact>true</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
答案 0 :(得分:0)
解决了此问题
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<executions>
<execution>
<id>make-jar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>project-${version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
<execution>
<id>make-tar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>src/main/resources-local/assembly.xml</descriptor>
<archive>
<manifest>
<mainClass>my.App</mainClass>
</manifest>
</archive>
<outputDirectory>output</outputDirectory>
</configuration>
</execution>
</executions>
</executions>
</plugin>