hav*_*ked 5 java gradle pom.xml maven
我有一个带有模块的父项目。其中一个模块在其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>
...
Run Code Online (Sandbox Code Playgroud)
mvn package
从父项目运行时,该项目将成功构建。然后,我想将此子模块项目用作其他gradle项目中的依赖项,因此我将父项目安装到我的maven本地仓库中,并在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
Run Code Online (Sandbox Code Playgroud)
为什么${os.detected.classifier}
不进行评估?应该注意的是,${netty.tcnative.version}
它被评估为在父pom中定义的属性,因为它出现在所寻求的jar路径中。
谢谢。
编辑:我认为问题可能是因为gradle引用了依赖项,并且没有调用maven来执行os-maven-plugin,后者评估表达式。只是一个猜测。
小智 0
当我的 POM 包含也定义为扩展的os.detected.classifier
父 POM 时,我发现无法正确解决问题。os-maven-plugin
您可以尝试将其配置为插件 https://github.com/trustin/os-maven-plugin#issues-with-eclipse-m2e-or-other-ides
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1594 次 |
最近记录: |