maven部署额外的jar文件 [英] maven deploy additional jar file
本文介绍了maven部署额外的jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个以特定方式构建和部署的工件(而不是jar文件)。在部署过程中,构建了一个war文件。
如何配置pom以便将工件也部署为jar文件到另一个位置?
解决方案
Maven deploy
表示将工件部署到 Maven资源库,而不是应用程序服务器。
配置这样的其他JAR工件:
<插件>
< 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>
将这个新工件附加到您的项目中:
< pre class =lang-js prettyprint-override>
< 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>某个文件< / file>
< type> jar< / type>
< / artifact>
< / artifacts>
< / configuration>
< / execution>
< / executions>
< / plugin>
I have an artifact which is being built and deployed in a particular way (not as a jar file). In the course of deployment, a war file is built.
How can I configure the pom so that the artifact is also deployed as a jar file, to a different location?
解决方案
Maven deploy
means deploy artifact to a Maven Repository, not an application server.
Configure additional JAR artifact like this:
<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>
Attach this new artifact to your project:
<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>some file</file>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
这篇关于maven部署额外的jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文