I want to publish my SDK in maven with $ ./gradlew uploadArchives
I had this project structure:
MyProject
|_ SDK
|_ src
|_ main
|_ java
|_ java files
|_ build.gradle
|_ gradle
|_ gradle-publish.gradle
I used following code (gradle-publish.gradle
) that works as expected:
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
uploadArchives {
repositories {
mavenDeployer {
/* ... */
}
}
}
artifacts {
archives sourcesJar
archives androidJavadocsJar
}
Now I splitted main module to 2: SDK
and new_module
so my project structure looks like:
MyProject
|_ SDK
|_ src
|_ main
|_ java
|_ java files "com.app"
|_ build.gradle
|_ new_module
|_ src
|_ main
|_ java
|_ java files "com.app.mod"
|_ build.gradle
|_ gradle
|_ gradle-publish.gradle
However no matter what I do, I always get only SDK
sources and not new_module
a.e. com.app
should be merged with com.app.mod
I tried to play with sourceSets
but it looks like it works inside main module SDK
and not under root project:
sourceSets {
main{
java {
srcDirs(
"src/main/java",
"../new_module/src/main/java"
)
}
}
and:
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
Any ideas, tips?