Maven:发布插件在 <distributionManagement> 中看不到我的 <repository>

标签 maven deployment repository maven-deploy-plugin

为了使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.xml 文件中。

...
<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。

最佳答案

由于 maven-release-plugin 不仅适用于本地文件,还适用于版本控制中的文件,看起来它实际使用的文件缺少 <distributionManagement>标签。

关于Maven:发布插件在 <distributionManagement> 中看不到我的 <repository>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13546539/

相关文章:

javascript - VueJS : Building for production. ..杀死

php - Symfony2 - 找不到自定义存储库

php - Laravel 错误接口(interface)类不存在

java - Jenkins 似乎无法构建 java Artifact 。更多信息包含在 github gist [Pastebin] 中

java - 如何修复无法在maven springmvc元素的maven构建中加载css文件

deployment - WebSphere Network Deployment 中的节点

deployment - 使用 cargo 和无效的 SSL 证书进行部署

asp.net-mvc - MVC3 设计 - 存储库模式和服务层

java - 删除 .m2 文件夹后 Maven 安装错误

jsp - 在 web-app 中使用 maven 和 eclipse 时抛出异常