如何使用mvn dependency:list命令跳过test / tes-jar依赖项

时间:2016-12-14 10:50:15

标签: spring maven spring-boot

我编写了一个shell脚本来计算项目的依赖关系。 Spring Boot Cli是这个项目的第一级依赖项,为了创建一个包含所有依赖项的csv文件,我只需从一组maven repo中获取pom文件然后运行命令: mvn依赖:list -f

然后使用一些格式化命令,我可以创建csv文件。这种方法总是有效但从Spring Boot Cli 1.4.0开始它不再起作用了。我收到了你可以在下面查看的错误。

由于我的方法一直工作到Spring Boot Cli 1.3.2版本,我比较了两个pom文件,我注意到添加了以下几行:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot</artifactId>
    <type>test-jar</type>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-test</artifactId>
    <scope>test</scope>
</dependency>

现在这些是测试依赖项,我对它们不感兴趣。我试图排除使用大量的命令(这里有一些例子):

mvn dependency:list -f <pom file> -DincludeScope="runtime"
mvn dependency:list -f <pom file> -DexcludeTypes="test-jar"
mvn dependency:list -f <pom file> -DskipTests
mvn dependency:list -f <pom file> -Dmaven.skip.test=true

但没有任何效果。 我如何运行&#34; mvn依赖:list&#34;命令跳过这些有问题的依赖项?

考虑到我的工具分析了数千个软件包,我需要一个适合所有软件包的解决方案,我无法实现Spring Boot Cli特有的功能,例如,从POM文件中删除这些行。

Look here:[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Spring Boot CLI 1.4.0.RELEASE
[INFO]
------------------------------------------------------------------------
Downloading: https://repo1.maven.org/maven2/org/springframework/boot/spring-boot/1.4.0.RELEASE/spring-boot-1.4.0.RELEASE-tests.jar
Downloading: http://dist.gemstone.com.s3.amazonaws.com/maven/release/org/springframework/boot/spring-boot/1.4.0.RELEASE/spring-  boot-1.4.0.RELEASE-tests.jar
Downloading: https://repo.spring.io/release/org/springframework/boot/spring-boot/1.4.0.RELEASE/spring-boot-1.4.0.RELEASE-tests.jar
Downloading: http://dl.bintray.com/groovy/maven/org/springframework/boot/spring-boot/1.4.0.RELEASE/spring-boot-1.4.0.RELEASE-tests.jar
Downloading: http://repository.jboss.org/nexus/content/groups/m2-release-proxy/org/springframework/boot/spring-boot/1.4.0.RELEASE/spring-boot-1.4.0.RELEASE-tests.jar    [INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 12.672 s
[INFO] Finished at: 2016-12-13T13:08:39-05:00
[INFO] Final Memory: 17M/158M
[INFO] 
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project spring-boot-cli: Could not resolve dependencies for project org.springframework.boot:spring- boot-cli:jar:1.4.0.RELEASE: Could not find artifact org.springframework.boot:spring-boot:jar:tests:1.4.0.RELEASE in mavencentral (https://repo1.maven.org/maven2) -> [Help 1]

0 个答案:

没有答案