6

To make Maven "deploy" to a directory, I use this:

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

This appears in the effective 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>

But still, Maven insists that it's not there:

[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

I am using it through the maven-release-plugin.

Update: This ^^^ seems to be the key part - mvn deploy works fine.

Related: http://www.java-tutorial.ch/maven/maven-release

What's wrong?

Maven 3.0.4. Pom to be added.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
  • 1
    First if you really like to deploy things into a directory use something which is outside your project like file:///home/ondra/repository/snapshots and file:///home/ondra/repository/releases Furthermore i don't see a relation between the error message your pom excerpts. So the best is to show the complete pom file and which command you exactly used. – khmarbaise Nov 25 '12 at 18:03
  • Which version of Maven is this? Which version of the maven-deploy-plugin are you using? Post your pom.xml. Not all of us have glass balls, or are psychic. :) – carlspring Nov 26 '12 at 10:40
  • Seems that the problem is that the release plugin somehow checks out wrong git tag, where element is missing. Finding out. The process is a bit tricky. – Ondra Žižka Nov 28 '12 at 05:30
  • If you added the information to the pom after running release:prepase, you need to run it again. release:perform does a checkout of a tag created by release:prepare. Hence, its impossible to make changes between prepare and perform. – Sven Amann Sep 26 '13 at 08:12

1 Answers1

0

Since maven-release-plugin works not only with the local file, but also with files in your version-control, it looks like the file it actually uses lacks the <distributionManagement> tag.

JBaruch
  • 22,610
  • 5
  • 62
  • 90