I have been searching for an answer to my question, but I found none. I built an android project with many modules. The modules should be published in a repository (at first in the local maven repository). I've done a demo project with two simple projects pr1, pr2. Now I've added to pr2 the dependency for pr1.
compile ('de.test:project1:1.0.0')
After that, I can publish both artifacts.
Now, when I change the name from pr2 to aPr2, the dependency can not be resolved from in aPr2, because the jar file does not exist. The problem is that aPr2 is built before pr1.
How can I tell Gradle to build it in the correct order?
This is my Gradle file from one of the projects. Pr1 is similar, without dependency.
plugins {
id 'java'
id 'maven-publish'
}
dependencies {
// compile project(':project1')
compile ('de.test:project1:1.0.0')
testCompile 'junit:junit:4.12'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
publish(MavenPublication) {
groupId 'de.test'
artifactId 'project2'
version '1.0.0'
from components.java
}
}
}