简体   繁体   English

maven-dependency-plugin 未显示测试范围的依赖项

[英]maven-dependency-plugin not showing test-scoped dependencies

I'm attempting to display the full tree of dependencies for a project I'm working on using the maven-dependency-plugin version 3.1.2 from the command line, but the mvn dependency:tree goal (nor any of the other goals from the maven-dependency-plugin) is not showing the test dependencies.我正在尝试显示我正在从命令行使用 maven-dependency-plugin 版本 3.1.2 的项目的完整依赖树,但mvn dependency:tree目标(也不是来自maven-dependency-plugin) 没有显示test依赖项。 The documentation of the plugin ( https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html ) states that all scopes are included by default, so using the -Dscope=test shouldn't be necessary (but when adding this parameter, the output doesn't change).插件的文档( https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html ,所以默认情况下应该包含所有范围的状态)必要(但添加此参数时,output 不会改变)。

I've run this with a clean.m2 repository, using no settings.xml file (to ensure that all artifacts are coming directly from repo.maven.apache.org ).我已经使用 clean.m2 存储库运行它,没有使用 settings.xml 文件(以确保所有工件都直接来自repo.maven.apache.org )。

I'm running using maven 3.6.2 on a linux environment (CentOS 7) and using Oracle Java 1.8.0_144 I'm running using maven 3.6.2 on a linux environment (CentOS 7) and using Oracle Java 1.8.0_144

Here's my POM:这是我的POM:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.sw-eval</groupId>
  <artifactId>cayenne-eval</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>org.apache.cayenne</groupId>
      <artifactId>cayenne-server</artifactId>
      <version>4.2.M2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cayenne</groupId>
      <artifactId>cayenne-di</artifactId>
      <version>4.2.M2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cayenne</groupId>
      <artifactId>cayenne-dbsync</artifactId>
      <version>4.2.M2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cayenne</groupId>
      <artifactId>cayenne-client</artifactId>
      <version>4.2.M2</version>
    </dependency>
  </dependencies>

</project>

Here's the output I receive from running the command mvn dependency:tree :这是我从运行命令mvn dependency:tree收到的 output :

[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------< com.sw-eval:cayenne-eval >----------------------
[INFO] Building cayenne-eval 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ cayenne-eval ---
[INFO] com.sw-eval:cayenne-eval:jar:1.0.0-SNAPSHOT
[INFO] +- org.apache.cayenne:cayenne-server:jar:4.2.M2:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.apache.cayenne:cayenne-di:jar:4.2.M2:compile
[INFO] +- org.apache.cayenne:cayenne-dbsync:jar:4.2.M2:compile
[INFO] |  +- org.apache.cayenne:cayenne-project:jar:4.2.M2:compile
[INFO] |  \- net.java.dev.inflector:inflector:jar:0.7.0:compile
[INFO] \- org.apache.cayenne:cayenne-client:jar:4.2.M2:compile
[INFO]    +- com.caucho:hessian:jar:4.0.63:compile
[INFO]    \- org.apache.cayenne:cayenne-rop-server:jar:4.2.M2:compile
[INFO]       +- org.apache.cayenne:cayenne-web:jar:4.2.M2:compile
[INFO]       \- org.slf4j:slf4j-simple:jar:1.7.25:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.951 s
[INFO] Finished at: 2020-11-25T08:53:17-07:00
[INFO] ------------------------------------------------------------------------

When referring to the cayenne-server pom, however, there are many dependencies marked as test which are not shown in the output (specifically, the following are direct dependencies of cayenne-server , see https://search.maven.org/artifact/org.apache.cayenne/cayenne-server/4.2.M2/jar ): When referring to the cayenne-server pom, however, there are many dependencies marked as test which are not shown in the output (specifically, the following are direct dependencies of cayenne-server , see https://search.maven.org/artifact /org.apache.cayenne/cayenne-server/4.2.M2/jar ):

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.cayenne.build-tools</groupId>
            <artifactId>cayenne-test-utilities</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-mock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mockrunner</groupId>
            <artifactId>mockrunner-jdbc</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <!-- this one have old Xerces dependency that clashes with JDK's one -->
                    <groupId>nekohtml</groupId>
                    <artifactId>nekohtml</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <scope>test</scope>
        </dependency>

So, is there something that I'm missing that needs to be enabled to show these test -scoped dependencies, and / or is this a weird artifact unique to the cayenne-server dependency?那么,是否需要启用某些我缺少的东西才能显示这些test范围的依赖项,和/或者这是cayenne-server依赖项独有的奇怪工件?

Thanks in advance!提前致谢!

Dependencies of scope test are not transitive. scope test的依赖关系不可传递。

The test dependencies of your dependencies are not part of your dependency tree.依赖项的test依赖项不是依赖项树的一部分。 They are ignored by Maven. Maven 忽略它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse 忽略 Maven 测试范围的依赖项 - Eclipse ignoring Maven test-scoped dependencies NoClassDefFoundError 当 Maven 测试范围依赖覆盖传递编译范围依赖时 - NoClassDefFoundError when Maven test-scoped dependency overrides transitive compile-scoped dependency maven-dependency-plugin 不能排除测试范围的依赖 - maven-dependency-plugin can't exclude test-scope dependencies 无法使Maven测试范围的依赖项与Java 9(或10)模块一起使用 - Can't make Maven test-scoped dependencies work with Java 9 (nor 10) modules Spring 引导核心依赖项被 maven-dependency-plugin 视为未使用 - Spring boot core dependencies seen as unused by maven-dependency-plugin 使用maven-dependency-plugin运行带有eclipse swt依赖关系的Java jar - Running a java jar with eclipse swt dependencies with maven-dependency-plugin 无法在 org.apache.maven.plugins:maven-dependency-plugin:jar:2.10 收集依赖项 - Failed to collect dependencies at org.apache.maven.plugins:maven-dependency-plugin:jar:2.10 maven-dependency-plugin忽略outputDirectory配置 - maven-dependency-plugin ignores outputDirectory configuration Maven的依赖插件不排除匹配的文件 - maven-dependency-plugin not excluding matching files maven-dependency-plugin没有使用destFileName? - destFileName not used by maven-dependency-plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM