【发布时间】:2015-09-03 12:21:26
【问题描述】:
我有一个带有模块的父项目。其中一个模块在其 pom 文件中声明了以下内容:
...
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.2.3.Final</version>
</extension>
</extensions>
</build>
...
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>${netty.tcnative.version}</version>
<classifier>${os.detected.classifier}</classifier>
</dependency>
</dependencies>
...
当mvn package 从父项目运行时,该项目将成功构建。然后我想将此子模块项目用作其他 gradle 项目中的依赖项,因此我将父项目安装到我的 maven 本地 repo 并在我的 build.gradle 文件中声明依赖项。
在构建 gradle 项目时,我遇到了这个错误:
Could not resolve all dependencies for configuration ':runtime'.
> Could not find netty-tcnative-${os.detected.classifier}.jar (io.netty:netty-tcnative:1.1.33.Fork2).
Searched in the following locations: https://repo.grails.org/grails/core/io/netty/netty-tcnative/1.1.33.Fork2/netty-tcnative-1.1.33.Fork2-${os.detected.classifier}.jar
为什么不评估${os.detected.classifier}?应该注意的是,${netty.tcnative.version} 被评估为在父 pom 中定义的属性,因为它出现在正在寻找的 jar 路径中。
谢谢。
edit:我认为问题可能是因为 gradle 引用了依赖项,并且没有调用 maven 来运行 os-maven-plugin,它评估表达式。只是猜测。
【问题讨论】: