2012-11-24 20 views
6

让Maven“部署”到一个目录,我用这个:Maven的:发布插件没有看到我的<repository>在<distributionManagement>

<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 

我使用它通过行家释放小插件。

更新:这^^^似乎是关键部分 - mvn deploy工作正常。

相关:http://www.java-tutorial.ch/maven/maven-release

有什么不对?

Maven 3.0.4。 POM被添加。

+1

首先,如果您真的想将某些东西部署到目录中,请使用file:/// home/ondra/repository/snapshots和file:/// home/ondra/repository/releases之外的项目。没有看到你的POM节选的错误信息之间的关系。所以最好的是显示完整的pom文件和您正确使用的命令。 – khmarbaise

+0

哪个版本的Maven是这个?你使用的是哪个版本的maven-deploy-plugin?发布您的pom.xml。不是我们所有人都有玻璃球,或者是精神上的。 :) – carlspring

+0

似乎问题在于释放插件以某种方式检出错误的git标记,其中元素缺失。发现。这个过程有点棘手。 –

回答

0

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

相关问题