jsi*_*ira 7 maven maven-release-plugin
根据文档,Maven版本:执行目标检查项目,然后分叉一个新的Maven实例来构建它.由于某种原因,forked实例似乎忽略了用户settings.xml,这导致我的情况出错,因为该文件具有用于在父pom中组成存储库URL的属性的定义.
用户的settings.xml
"nexus"配置文件中始终处于活动状态的属性的定义.
<profiles>
<profile>
<id>nexus</id>
<properties>
<dist.url>http://host.com/nexus/content/repositories</dist.url>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
Run Code Online (Sandbox Code Playgroud)Parent的pom.xml
使用定义的属性来组成存储库的URL.
<distributionManagement>
<repository>
<id>nexus</id>
<url>${dist.url}/releases</url>
</repository>
</distributionManagement>
Run Code Online (Sandbox Code Playgroud)执行命令:
mvn release:perform
Run Code Online (Sandbox Code Playgroud)输出(表示已成功检出,构建,测试和打包项目):
[INFO] Uploading: ${dist.url}/releases/com/acme/access/my-project/1.0/my-project-1.0.jar
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 3.659s
[INFO] [INFO] Finished at: Wed Aug 01 14:40:23 EDT 2012
[INFO] [INFO] Final Memory: 21M/307M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [WARNING] The requested profile "nexus" could not be activated because it does not exist.
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-project: Failed to deploy artifacts: Could not transfer artifact com.acme.access:my-project:jar:1.0 from/to nexus (${dist.url}/releases): Error transferring file: no protocol: ${dist.url}/releases/com/acme/access/my-project/1.0/my-project-1.0.jar -> [Help 1]
Run Code Online (Sandbox Code Playgroud)注意分叉的Maven实例如何尝试上传到$ {dist.url},这表示未读取settings.xml中定义的属性.此外,警告消息通知未找到配置文件"nexus".我假设主Maven实例将配置文件信息传递给分叉实例,因此它知道要查找它,但由于它忽略(或没有找到)用户的settings.xml,因此无法找到该配置文件.
我发现绕过这个的唯一方法是settings.xml通过使用-s插件的arguments参数"包装" Maven的命令行参数来手动指定文件的位置,如
mvn release:perform -Darguments="-s C:\Users\theuser\.m2\settings.xml"
Run Code Online (Sandbox Code Playgroud)
插件是否以预期/正确的方式运行?有没有办法将属性定义保留在用户的内部,settings.xml而不必像上面那样指定文件的位置?
更多信息:
问题似乎特别是插件没有找到用户settings.xml,因为将配置文件信息复制到全局settings.xml确实会使它工作.
用户的settings.xml正确命名/创建,因为运行help:active-profiles表明配置文件被激活.手动构建和部署mvn clean deploy也可正常工作(即,正确计算存储库URL并上载工件).
| 归档时间: |
|
| 查看次数: |
3747 次 |
| 最近记录: |