Sergio
Sergio

Reputation: 8672

Distributing application with its Maven POM only

Is it possible to distribute my application with its POM only ?

I have deployed my application in a remote repository and I think it would be nice if I can distribute only its POM, instead of asking the users to download the complete source first and use the POM to build the application afterwards. The idea is that users would be able to install the application using the POM and a single Maven command.

I tried adding to the POM a downloadURL in a distributionManagement section without success. Here my experiment:

<?xml version="1.0" encoding="UTF-8"?>
<project>

<modelVersion>4.0.0</modelVersion>
<groupId>aGroupId</groupId>
<artifactId>anArtifactId</artifactId>
<version>0.0.1</version>

<distributionManagement>
    <downloadUrl>anURL</downloadUrl>
</distributionManagement>

<repositories>
    <repository>
      <id>someId</id>
      <url>anURL</url>
    </repository>
</repositories>
</project>

Thanks in advance for any feedback

Upvotes: 2

Views: 353

Answers (2)

tdrury
tdrury

Reputation: 2338

If you're distributing source, then you should look at the bootstrap POM method: http://maven.apache.org/scm/maven-scm-plugin/examples/bootstrapping-with-pom.html

where the 'scm' element is key. The user has only to run scm:bootstrap to then receive the project source tree from which to build the project.

-tim

Upvotes: 3

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298888

You can use the dependency:get mojo to download an artifact to a specified location:

mvn dependency:get -Dartifact=<groupid>:<artifactid>:<version> /
 -Ddest=path/to/destination.jar

Upvotes: 1

Related Questions