【问题标题】:How to find a dependency in maven, dependency:tree doesn't work如何在maven中找到依赖项,依赖项:树不起作用
【发布时间】:2023-03-08 17:20:02
【问题描述】:

在我看到的有效 pom 中

<plugin>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.3</version>
    <executions>
      <execution>
        <id>default-site</id>
        <phase>site</phase>
        <goals>
          <goal>site</goal>
        </goals>
        <configuration>
          <outputDirectory>/home/tatiana/repos/selenium-tests/masbuilder-tests/target/site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </execution>
      <execution>
        <id>default-deploy</id>
        <phase>site-deploy</phase>
        <goals>
          <goal>deploy</goal>
        </goals>
        <configuration>
          <outputDirectory>/home/tatiana/repos/selenium-tests/masbuilder-tests/target/site</outputDirectory>
          <reportPlugins>
            <reportPlugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </reportPlugin>
          </reportPlugins>
        </configuration>
      </execution>
    </executions>
    <configuration>
      <outputDirectory>/home/tatiana/repos/selenium-tests/masbuilder-tests/target/site</outputDirectory>
      <reportPlugins>
        <reportPlugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
        </reportPlugin>
      </reportPlugins>
    </configuration>
  </plugin>

但是我不使用 maven-site-plugin 并且当我执行时 mvn 依赖:树

然后我在输出中看不到任何提及 maven-site-plugin 或“site”关键字或 maven-project-info-reports-plugin。

同样适用 mvn 依赖:tree -Dverbose

问题是我想删除的有效 POM 中的错误: 这里不允许使用元素报告插件

也许它与我使用的 maven-surefire-plugin 相关?

【问题讨论】:

  • 您确定您使用的某些库对 maven-site-plugin 没有传递依赖吗?
  • 如何查看/查看?我尝试使用 mvn dependency:tree -Dverbose 没有成功(请参阅依赖项但不是这个)
  • 听起来你是从你正在使用的一些父母那里继承来的......?
  • 我不这么认为,如何确定?

标签: java maven pom.xml maven-surefire-plugin


【解决方案1】:

如果树中较高版本的依赖已经存在,则所有 jruby-complete 的依赖都列在树中较浅的深度,因为依赖树 mojo 会修剪较低级别的依赖。

您可以使用mvn dependency:tree -Dverbose=true 来显示省略的依赖项。

【讨论】:

【解决方案2】:

verbose 可能不适用于 Maven 3。还有另一个 solution from different question 使用 depgraph-maven-plugin

mvn com.github.ferstl:depgraph-maven-plugin:3.3.0:graph -DrepeatTransitiveDependenciesInTextGraph -DshowVersions -DgraphFormat=text -DshowGroupIds -DshowConflicts -DshowDuplicates

【讨论】:

    猜你喜欢
    • 2016-10-01
    • 2020-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-03
    • 2021-01-21
    相关资源
    最近更新 更多