java maven-deploy-plugin 不知道我将它声明为构建插件的 pom 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45312708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Isn't maven-deploy-plugin aware of the pom in which I declared it as a build plugin?
提问by Blessed Geek
I have a maven project. In the pom I declared the group id, artifact id, version.
我有一个 Maven 项目。在 pom 中,我声明了组 ID、工件 ID、版本。
I declared for maven-deploy-plugin as a build plugin, with goal of deploy:deploy-file.
我将 maven-deploy-plugin 声明为构建插件,目标是 deploy:deploy-file。
Then I launched maven from eclipse with the same goal, wuth -Durl declared as jvm arg.
然后我以相同的目标从 eclipse 启动了 maven,wuth -Durl 声明为 jvm arg。
Maven build fails saying I did not supply groupid, artifactid, package, file not defined.
Maven 构建失败,说我没有提供 groupid、artifactid、package、file not defined。
Why doesn't it get those values from the pom?
为什么不从 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?
一定有办法告诉插件使用 pom 值,对吗?因为 maven 人肯定相信 DIE-DRY - 重复是邪恶的,不要重复自己吗?否则,我可以创建一个与其 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.
为什么,插件不知道我希望部署项目,包括源代码而不仅仅是单个 jar 或 pom?
为什么,插件不知道它应该只查看 pom artifactid 声明来获取 groupid 和 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?
- 如果缺少这些功能,尽管我强烈希望它们不会丢失 - 为什么插件开发人员不觉得这些是重要的功能?
回答by burna
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.
目标deploy:deploy-file
用于部署不是由 maven 构建的工件,这就是您必须指定参数的原因。
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:
要部署由 maven(一个普通的 maven 项目)构建的工件,您应该只使用deploy
目标并在 pom.xml 中使用distributionManagement
元素指定目标存储库,如下所示:
<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.
然后你可以调用mvn deploy
你的项目根目录。
That would be the default maven way to deploy your projects to another maven repository.
这将是将项目部署到另一个 maven 存储库的默认 maven 方式。