本文介紹了是否使用Maven部署其他JAR文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我有一個構件,它是以一種特定的方式構建和部署的(不是JAR文件)。在部署過程中,將構建一個WAR文件。
如何配置POM以使項目也作為JAR文件部署到其他位置?
推薦答案
Mavendeploy
表示將項目部署到Maven存儲庫,而不是應用程序服務器。
按如下方式配置其他JAR項目:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>make-a-jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
將此新項目附加到您的項目:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
<!-- <file>${project.build.directory}/${project.build.finalName}.jar</file> - if finalName is defined -->
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
這篇關于是否使用Maven部署其他JAR文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,