【发布时间】:2012-11-12 20:22:37
【问题描述】:
为了让 Maven “部署”到一个目录,我使用这个:
<distributionManagement>
<downloadUrl>http://code.google.com/p/junitdiff/downloads/list</downloadUrl>
<repository>
<id>local-hack-repo</id>
<name>LocalDir</name>
<url>file://${project.basedir}/dist-maven</url>
</repository>
<snapshotRepository>
<id>jboss-snapshots-repository</id>
<name>JBoss Snapshots Repository</name>
<!--
<url>https://repository.jboss.org/nexus/content/repositories/snapshots</url>
-->
<url>file://${project.basedir}/dist-maven</url>
</snapshotRepository>
</distributionManagement>
这出现在有效的 pom 中。
...
<distributionManagement>
<repository>
<id>local-hack-repo</id>
<name>LocalDir</name>
<url>file:///home/ondra/work/TOOLS/JUnitDiff/github/dist-maven</url>
</repository>
<snapshotRepository>
<id>jboss-snapshots-repository</id>
<name>JBoss Snapshots Repository</name>
<url>file:///home/ondra/work/TOOLS/JUnitDiff/github/dist-maven</url>
</snapshotRepository>
<downloadUrl>http://code.google.com/p/junitdiff/downloads/list</downloadUrl>
</distributionManagement>
但是,Maven 坚持认为它不存在:
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project JUnitDiff: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
[INFO] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project JUnitDiff: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
...
[INFO] Caused by: org.apache.maven.plugin.MojoExecutionException: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
[INFO] at org.apache.maven.plugin.deploy.DeployMojo.getDeploymentRepository(DeployMojo.java:235)
[INFO] at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:118)
[INFO] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
[INFO] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
[INFO] ... 19 more
我通过 maven-release-plugin 使用它。
更新:这个 ^^^ 似乎是关键部分 - mvn deploy 工作正常。
相关:http://www.java-tutorial.ch/maven/maven-release
怎么了?
Maven 3.0.4。 Pom 待添加。
【问题讨论】:
-
首先,如果您真的想将内容部署到目录中,请使用项目外部的内容,例如 file:///home/ondra/repository/snapshots 和 file:///home/ondra/repository /releases 此外,我看不到您的 pom 摘录的错误消息之间的关系。所以最好是显示完整的 pom 文件以及你使用的命令。
-
这是哪个版本的 Maven?您使用的是哪个版本的 maven-deploy-plugin?发布您的 pom.xml。并非我们所有人都有玻璃球,或者是通灵者。 :)
-
似乎问题在于发布插件以某种方式检查了错误的 git 标签,其中缺少元素。找出来。这个过程有点棘手。
-
如果你在运行 release:prepase 后将信息添加到 pom 中,则需要再次运行。 release:perform 对 release:prepare 创建的标签进行检查。因此,不可能在准备和执行之间进行更改。
标签: maven deployment repository maven-deploy-plugin