Hi everyone
I have problem publishing multimodule project using maven-publish plugin. I just can’t pick-up jars. I have root build.gradle like this:
allprojects {
repositories {
jcenter()
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
publishing {
publications {
compiler(MavenPublication) {
groupId 'com.levelmoney.kbuilders'
artifactId project.name
version rootProject.version
}
}
}
}
If I put from components.java then I get error about missing jar file because one of submodules have custom jar name:
jar {
baseName 'something-else'
}
If I put artifact jar then I get error that it couldn’t convert lambda to the artifact.
If i put
artifacts {
archives jar
}
then nothing changes
So is there any way to publish artifacts?
UPD
The only solution I found is to make everything by hand that is too stupid
apply plugin: 'maven-publish'
publishing {
publications {
compiler(MavenPublication) {
groupId 'com.levelmoney.kbuilders'
artifactId 'compiler'
version rootProject.version
artifact file('compiler/build/libs/kbuilders.jar')
}
gradlePlugin(MavenPublication) {
groupId 'com.levelmoney.kbuilders'
artifactId 'gradle-plugin'
version rootProject.version
artifact file('gradle-plugin/build/libs/gradle-plugin.jar')
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
project("gradle-plugin").configurations.getByName("runtime").allDependencies.findAll { it.name != 'unspecified' }.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version == 'unspecified'? rootProject.version : it.version)
}
}
}
}
}