mvn dependency:copy-dependencies 删除版本

发布于 2024-10-08 21:20:02 字数 436 浏览 10 评论 0原文

我正在使用“mvn dependency:copy-dependencies”来获取我的项目使用的依赖项的所有源。 我从命令行使用它,所以它看起来像这样:

mvn dependency:copy-dependencies -Dclassifier=sources -DincludeScope=compile

除了一个小问题之外,它工作正常:由于某种原因,该版本被这个插件删除了。因此,我得到的是 commons-logging-1.1.1-sources.jar,而不是 commons-logging-sources.jar

该文档说“stripVersion”参数应该影响此行为,但默认值是 false。此外,我尝试明确设置它,但没有帮助。

我正在使用 apache-maven-2.2.1 和 jdk1.6.0_21

谢谢, 塔洛格。

I'm using "mvn dependency:copy-dependencies" to get all sources of the dependencies my project uses.
I use it from command line, so it looks like this:

mvn dependency:copy-dependencies -Dclassifier=sources -DincludeScope=compile

It works fine except of a small problem: For some reason the version is removed by this plugin. So instead of commons-logging-1.1.1-sources.jar, I'm getting commons-logging-sources.jar

The documentation says that "stripVersion" argument should effect this behavior, but the default value is false. Moreover, I tried to set it explicitly and it didn't help.

I'm using apache-maven-2.2.1 with jdk1.6.0_21

Thanks,
Tarlog.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浮生未歇 2024-10-15 21:20:02

这很奇怪,你可以在源代码中看到(Mojo父 Mojo< /a>, DependencyUtil) stripVersion 执行它所说的操作。

几种可能性:

a) 您使用的是当前版本的依赖插件吗?

配置您的 pom

 <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
      </plugin>
    </plugins>
  </build>

或使用完全限定的目标名称:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:copy-dependencies

b) stripVersion 是 XML 配置中的参数名称。命令行版本是

-Dmdep.stripVersion=false

尝试使用它。

That's very strange, you can see in the source (Mojo, Parent Mojo, DependencyUtil) that stripVersion does what it says it does.

Several possibilities:

a) Are you using the current version of the dependencies plugin?

Either configure your pom

 <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
      </plugin>
    </plugins>
  </build>

or use the fully qualified goal name:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:copy-dependencies

b) stripVersion is the parameter name in XML configuration. The command line version is

-Dmdep.stripVersion=false

Try using that.

天涯沦落人 2024-10-15 21:20:02

我找到了问题的根本原因。在...我的 pom 的父级的父级的父级的某处,stripVersion 设置为 true。
我不知道这一点,并且认为设置系统属性必须覆盖 xml。我什至尝试将此属性放入我的 pom 中,但仍然没有帮助。不知何故,父 pom 仍然占主导地位,所以我认为该属性不起作用。

当我使用 -X param 运行时,尽管我的配置没有改变,但我发现它没有改变,所以我开始挖掘父 poms,除非发现问题。

谢谢大家!

I found the root cause of a problem. Somewhere in the parent of parent of parent of ... my pom, stripVersion was set to true.
I didn't know about it and anyway thought that setting the system property must override the xml. I even tried to put this property in my pom and it still didn't help. Somehow, the parent pom stayed the dominant one, so I thought that the property doesn't work.

When I ran with -X param I saw it no changing despite my configuration, so I started digging in the parent poms unless I found the problem.

Thanks to everyone!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文