我想maven將陰影插件創建的超級jar和all_files目錄下的shell腳本合併在一起。maven zip超級jar和shell腳本
項目結構如下所示:
all_files/
mvn_script.sh
projB-shaded.jar
maven_project/
guide/
parent-pom.xml
projA/
pom.xml
projB/
pom.xml
的罐子被項目B的POM文件生成,然後放入outtermost文件夾準備好與shell腳本來拉上。原因是,shell腳本可以調用jar文件來執行該項目。
我希望其他程序員能夠輕鬆解壓縮文件並運行shell腳本而不用擔心。而且我還需要將maven包裝在腳本和jar中。我不確定如何在陰影插件中實現它。
注意:我不想使用assembly-plugin,因爲它沒有打包依賴的jar。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<outputFile>../../guide/${project.artifactId}-${project.version}-shaded.jar</outputFile>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>projB.classB</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
如何將projB-shaded.jar和mvn_script.sh這兩個文件添加到一個zip文件中? – Abhi
在準備包中運行陰影會導致失敗。它似乎在包中運行,還是有另一種配置允許它運行更早? – puhlen