Isn't maven-deploy-plugin aware of the pom in which I declared it as a build plugin?

22,676

The goal deploy:deploy-file is used to deploy artifacts, that were not built by maven, that is why you have to specify the parameters.

To deploy an artifact, that was built by maven (a normal maven project), you should only use the deploy goal and specify the target repository in your pom.xml with the distributionManagement element, like this:

<distributionManagement>
    <repository>
        <uniqueVersion>false</uniqueVersion>
        <id>corp1</id>
        <name>Corporate Repository</name>
        <url>file:///home/myfolder/.m2</url>
        <layout>default</layout>
    </repository>
</distributionManagement>

Then you can just call mvn deploy in your project root.

That would be the default maven way to deploy your projects to another maven repository.

Share:
22,676

Related videos on Youtube

Blessed Geek
Author by

Blessed Geek

מבורכים החנונים

Updated on July 26, 2020

Comments

  • Blessed Geek
    Blessed Geek almost 4 years

    I have a maven project. In the pom I declared the group id, artifact id, version.

    I declared for maven-deploy-plugin as a build plugin, with goal of deploy:deploy-file.

    Then I launched maven from eclipse with the same goal, wuth -Durl declared as jvm arg.

    Maven build fails saying I did not supply groupid, artifactid, package, file not defined.

    Why doesn't it get those values from the pom?

    There must be a way ti tell the plugin to use the pom values, right? Because the maven people certainly believe in DIE-DRY - duplication is evil, don't repeat yourself? Otherwise, I could create an artefact distribution that contradicts its pom?

    1. Why, doesn't the plugin know I wish to deploy the project, including the source and not just a single jar or pom?

    2. Why, doesn't the plugin know it should just look at the pom artifactid declaration to get the groupid and artifactid.

    Rant:

    • If these features are missing, though I strongly hope they are not mmissing - Why, doesn't the plugin developer feel these are important features?
    • khmarbaise
      khmarbaise almost 7 years
      The maven-deploy-plugin:deploy-file should never being part of a pom file cause all artifacts are already built by your maven build and can be deployed just by using mvn deploy. If you need to do that you are doing something wrong..Please show your pom file...
    • Blessed Geek
      Blessed Geek almost 7 years
      Yes, I found it was not necessary.
  • Blessed Geek
    Blessed Geek almost 7 years
    I have two other repo declarations in the pom. Now a 3rd one for the project dir repo. How do I tell maven deploy to use the project dir repo out of the three?