[英]Maven: Java jar dependencies not copied
我有一個依賴於工作區中不同項目模塊的項目。 我試圖將所有依賴項復制到lib文件夾中以創建可執行jar。
我運行mvn package
,看到BUILD SUCCESS
。
但是我看不到應該有依賴關系的任何目標文件夾lib
,並且沒有創建文件Nespresso12345.jar。 我想知道為什么。
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<destFileName>Nespresso12345.jar</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/lib2</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
使用Maven Shade插件創建可執行的JAR。 效果很好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.