gpt4 book ai didi

maven - 我可以包含 mvn deploy :deploy-file in the pom or settings. xml 而不是 cli 目标吗

转载 作者:行者123 更新时间:2023-12-03 14:12:35 25 4
gpt4 key购买 nike

我需要将自定义 jar 与从我的 Java 项目生成的 jar 一起部署到 Artifactory。目前我能找到的唯一方法是通过命令行目标使用:

mvn deploy:deploy-file -DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-Dpackaging=<type-of-packaging> \
-Dfile=<path-to-file> \
-Durl=<url-of-the-repository-to-deploy>

有没有办法将它包含在 pom 文件中?作为插件还是什么?

最佳答案

当然。只需定义 maven-deploy-plugin:deploy-file 的执行即可目标绑定(bind)到 deploy阶段,配置有您的值。部署项目时,将调用此执行并部署 JAR。

<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>deploy-file</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file><!-- path-to-file --></file>
<url><!-- url-of-the-repository-to-deploy --></url>
<groupId><!-- group-id --></groupId>
<artifactId><!-- artifact-id --></artifactId>
<version><!-- version --></version>
<packaging><!-- type-of-packaging --></packaging>
</configuration>
</execution>
</executions>
</plugin>

请注意,您可能需要添加 repositoryId 还。这是要映射到 <id> 上的服务器 ID下 <server> settings.xml 的部分.

关于maven - 我可以包含 mvn deploy :deploy-file in the pom or settings. xml 而不是 cli 目标吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35158890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com