2015-09-25 51 views
0

我想通過Gradle(從我設置的私有存儲庫,而不是從maven中心)向Android項目添加工件,直接工件下載得很好,但是它的依賴關係沒有被下載。Gradle沒有下載鏈接到工件的依賴關係

這是我的代碼:

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.example</groupId> 
    <artifactId>artifactId</artifactId> 
    <version>1.0.0</version> 
    <packaging>aar</packaging> 
    <dependencies> 
    <dependency> 
     <groupId>com.example</groupId> 
     <artifactId>dependencyId</artifactId> 
     <version>1.0.0</version> 
    </dependency> 
    </dependencies> 
</project> 

POM的依賴構件:

我的主神器的POM

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.example</groupId> 
    <artifactId>dependencyId</artifactId> 
    <version>1.0.0</version> 
</project> 

上的應用程序搖籃代碼:

repositories { 
    maven { 
     url "<private-url-repo>" 
    } 
} 

dependencies { 
    compile('com.example:artifactId:[email protected]') 
} 

回答

0

我發現在嘗試一些東西后如何做到這一點,所以張貼萬一它有助於任何人。解決方法是將transitive = true;添加到像這樣的依賴項中:

dependencies { 
    compile('com.example:artifactId:[email protected]') { 
     transitive = true;  
    } 
}