问题
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?
Why, doesn't the plugin know I wish to deploy the project, including the source and not just a single jar or pom?
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