Gradle generating incorrect POM subproject information

I have a project Android

using Gradle 2.2

, it has 2 sub-projects and one depends on the other. I am using Maven plugin

to deploy to Artifactory

and is not generating the correct POM.

-project
 -subproject1 
 -subproject2 (depends on subproject1)

      

subproject1 / build.gradle generates JAR:

apply plugin: 'java'
apply plugin: 'maven'

def version = '1.0.0-SNAPSHOT'
def artifactId = 'subproject1'
def groupId    = 'com.xxx.yyy'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])    
    compile 'junit:junit:4.11'
    compile 'org.slf4j:slf4j-api:1.7.7'
}

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: 'https://my-artifactory-repo' ) {
                authentication(userName: ..., password: ...)
            }
            snapshotRepository(url: 'https://my-artifactory-repo' ) {
                authentication(userName: ..., password: ...)
            }
            pom.version = version
            pom.artifactId = artifactId
            pom.groupId = groupId
        }
    }
}

task installArchives(type: Upload) {
    configuration = configurations['archives']
    repositories {
        mavenDeployer {
            repository url: 'my-local-repo-path'
            pom.version    = version
            pom.artifactId = artifactId
            pom.groupId    = groupId
        }
    }
}

      

The POM subproject is generated correctly.

subproject2 / build.gradle generates AAR:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.slf4j:slf4j-api:1.7.7'
    compile project(':subproject1')
}

      

POM subproject2 is not generated correctly, for subproject1

value groupid

has the same meaning as artifactId and is version

not specified. Does anyone know how to fix this?

+3


source to share





All Articles