【发布时间】:2012-12-01 15:53:28
【问题描述】:
我可以通过在我的pom.xml 中使用以下内容并运行mvn deploy 来部署jar:
<distributionManagement>
<repository>
<id>releases</id>
<url>http://${host}:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://${host}:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
我可以使用以下代码构建一个可执行文件jar-with-dependencies:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-executable-jar</id>
<phase>deploy</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>my.company.app.Main</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
问题是我不知道如何将这些组合在一起以将可执行文件 jar 部署到我的 Maven 存储库。我真的不知道这是通过新插件还是通过向现有程序集插件添加目标或其他步骤来完成的。
【问题讨论】:
-
有趣...所以您想要一个包含所有依赖项 (
jar-with-dependencies) 到 nexus 的 jar?我假设当你将它部署到生产环境时,这个 jar 将是独立的(因为它嵌入了所有依赖项)?
标签: java maven deployment