java - 使用 maven 插件下载具有依赖关系的特定 jar
问题描述
我需要下载一组具有依赖关系的特定 jar 并将其放在单独的文件夹中。下面是我来自 pom.xml 的代码
<profile>
<id>copy-dep</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>xxx</version>
</artifactItem>
<artifactItem>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>xxx</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
当我使用以下命令时,只会下载特定的依赖项,而不是传递依赖项。如果我不能使用排除标签,也可以使用 artifactItem。
mvn dependency:copy -Pcopy-dep
如果我使用mvn dependency:copy-dependencies
它会在 pom.xml 中查找我不想要的所有依赖项。我尝试替换<artifactItems>
为<dependencies>
但也没有用,出现以下错误
Caused by: org.apache.maven.plugin.MojoFailureException: Either artifact or artifactItems is required
有没有办法我可以获得所有选定的依赖项(具有传递依赖项)并排除一些依赖项?如果有更好的插件可以推荐。
解决方案
推荐阅读
- sql - 基于值而不是计数的 ntile 函数
- java - 如何修复 application.yml 文件中的解析异常?
- wordpress - 获取WordPress中特定页面的最后修改日期
- java - 标记为只读的 PDComboBox 在 PDF 文档中不可见
- parallel-processing - 来自 RevoScaleR 的 rxExec 不会发生并行处理
- php - 如何在 Wordpress 模板上修复移动屏幕底部的按钮
- docusignapi - Dosusign API 访问令牌延长到期
- c# - For 循环增加文本框 ID。C# Windows 窗体
- ecmascript-5 - 在我的 tsconfig 中使用 es2017 作为库但将 es5 作为我的目标会使我的代码与 IE11 不兼容吗?
- python - 为什么在python类中设置方法在调用时不传递self?