我正在尝试使用Flex库(SWC),它在其POM中定义了一些依赖项.我希望Gradle会自动提供那些传递性的依赖性.但是,gradle dependencies仅显示已手动添加的一个依赖项.
merged
\--- com.example:flex-core:1.0.0
Run Code Online (Sandbox Code Playgroud)
该库的POM文件包含以下内容:
<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.example</groupId>
<artifactId>flex-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>swc</packaging>
<dependencies>
<dependency>
<groupId>org.as3commons</groupId>
<artifactId>as3commons-lang</artifactId>
<version>0.3.6</version>
<type>swc</type>
<scope>external</scope>
</dependency>
<dependency>
<groupId>org.as3commons</groupId>
<artifactId>as3commons-collections</artifactId>
<version>1.3.2</version>
<type>swc</type>
<scope>external</scope>
</dependency>
<dependency>
<groupId>org.as3commons</groupId>
<artifactId>as3commons-reflect</artifactId>
<version>1.6.0</version>
<type>swc</type>
<scope>external</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
我在我的添加中添加了以下依赖项build.gradle:
dependencies {
merged 'com.example:flex-core:1.0.0@swc'
}
Run Code Online (Sandbox Code Playgroud)
为什么Gradle忽略了POM的依赖关系?是因为"外部"范围?是否可以在不手动添加依赖项的情况下获取这些依赖项?
在声明依赖项()时,您只使用工件表示法@scw.这意味着Gradle将仅检索工件本身,但不使用POM中的传递依赖项.
试试这个:
dependencies {
merged 'com.example:core:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)
名字不应该是flex-core?至少这就是POM上面所说的.
| 归档时间: |
|
| 查看次数: |
981 次 |
| 最近记录: |