maven-deploy-plugin 不知道我将它声明为构建插件的 pom 吗? [英] Isn't maven-deploy-plugin aware of the pom in which I declared it as a build plugin?

查看:50
本文介绍了maven-deploy-plugin 不知道我将它声明为构建插件的 pom 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Maven 项目.在 pom 中,我声明了组 ID、工件 ID、版本.

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

我将 maven-deploy-plugin 声明为构建插件,目标是 deploy:deploy-file.

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

然后我以相同的目标从 eclipse 启动了 maven,将 -Durl 声明为 jvm arg.

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

Maven 构建失败,说我没有提供 groupid、artifactid、package、file not defined.

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

为什么不从 pom 中获取这些值?

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

一定有办法告诉插件使用 pom 值,对吗?因为 maven 人肯定相信 DIE-DRY - 重复是邪恶的,不要重复自己吗?否则,我可以创建一个与其 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. 为什么,插件不知道我希望部署项目,包括源代码,而不仅仅是单个 jar 或 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?

为什么,插件不知道它应该只查看 pom artifactid 声明以获取 groupid 和 artifactid.

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

咆哮:

  • 如果缺少这些功能,但我强烈希望它们不会丢失 - 为什么,插件开发人员不觉得这些功能很重要?

推荐答案

目标 deploy:deploy-file 用于部署非 Maven 构建的工件,这就是为什么你必须指定参数.

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.

要部署由 maven(一个普通的 maven 项目)构建的工件,您应该只使用 deploy 目标并使用 distributionManagement 在 pom.xml 中指定目标存储库 元素,像这样:

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>

然后你可以在你的项目根目录中调用 mvn deploy.

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

这将是将项目部署到另一个 Maven 存储库的默认 Maven 方式.

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

这篇关于maven-deploy-plugin 不知道我将它声明为构建插件的 pom 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆