【问题标题】:mvn dependency:tree, multi-module and ${revision}mvn 依赖:树、多模块和 ${revision}
【发布时间】:2019-04-07 21:08:38
【问题描述】:

dependency:tree 理解 ${revision} 吗?

我有一个多模块项目 X:

<groupId>org.X</groupId>
<artifactId>X-parent</artifactId>

<version>${revision}</version>
<properties>
    <revision>8.0.0-SNAPSHOT</revision>
</properties>

<modules>
    <module>X-A</module>
    :

它安装在我的本地 .m2 中(并且仅在那里)。

我有一个项目 Y,它依赖于 X-A,修订版 8.0.0-SNAPSHOT

Project Y 的 pom 还包括:

  <repositories>
        <repository>
          <id>rescarta</id>
          <url>http://software.rescarta.org/nexus/content/groups/public/</url>
        </repository>
    </repositories> 

当我在项目 Y 上运行 mvn dependency:tree 时,它​​会抱怨:

$ mvn -U dependency:tree
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.pom (14 kB at 7.0 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/3.0.1/maven-dependency-plugin-3.0.1.jar (164 kB at 186 kB/s)
[INFO] 
[INFO] -------------------< com.y:Y >-------------------
[INFO] Building Y 8.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from rescarta: http://software.rescarta.org/nexus/content/groups/public/org/x/X-A/8.0.0-SNAPSHOT/maven-metadata.xml
Downloading from rescarta: http://software.rescarta.org/nexus/content/groups/public/org/x/X-parent/$%7Brevision%7D/X-parent-$%7Brevision%7D.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/x/X-parent/$%7Brevision%7D/X-parent-$%7Brevision%7D.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.681 s
[INFO] Finished at: 2019-04-08T06:45:53+10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Y: Could not resolve dependencies for project com.y:Y:jar:8.0.0-SNAPSHOT: Failed to collect dependencies at org.x:X-A:jar:8.0.0-SNAPSHOT: Failed to read artifact descriptor for org.x:X-A:jar:8.0.0-SNAPSHOT: Could not find artifact org.x:X-parent:pom:${revision} in rescarta (http://software.rescarta.org/nexus/content/groups/public/) -> [Help 1]

注意它正在尝试下载 org.x:X-parent:pom:${revision},而不是 org.x:X-parent:pom:8.0.0-SNAPSHOT

dependency:tree 不知道如何解析 ${revision} 吗?

【问题讨论】:

    标签: maven maven-3


    【解决方案1】:

    https://stackoverflow.com/a/52173650/1031689 中解释的 flatten-maven-plugin 似乎是一种有效的解决方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-21
      • 2012-03-02
      • 1970-01-01
      • 1970-01-01
      • 2013-11-05
      • 1970-01-01
      • 2010-10-22
      相关资源
      最近更新 更多