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

試著忘記壹切 提交于 2020-08-05 06:14:18

问题


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?

回答1:


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.



来源:https://stackoverflow.com/questions/45312708/isnt-maven-deploy-plugin-aware-of-the-pom-in-which-i-declared-it-as-a-build-plu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!