Copy build artifacts with gradle

657 Views Asked by At

I use gradle to build android library and push it to remote maven repository. Is there some way to get resulting pom and aar files and copy it, for example, to root of the project?

Here is the task for publishing to maven (it's in library project build.gradle)

uploadArchives {
    configuration = configurations.archives
    repositories.mavenDeployer {

        repository(url: constants.snapshotUrl) {
            authentication(userName: userName, password: password)
            pom.groupId = constants.groupId
            pom.artifactId = constants.libUIArtifactIdName
            pom.version = constants.projectVersion
        }

        pom.whenConfigured { pom ->
            pom.dependencies.forEach { dep ->
                if (dep.getVersion() == "unspecified") {
                    dep.setGroupId(constants.groupId)
                    dep.setVersion(constants.projectVersion)
                }
            }
        }

    }
}
1

There are 1 best solutions below

0
Opal On BEST ANSWER

Are you using maven plugin? If so you'll find generated poms under ${project.buildDir}/poms and artifacts e.g. from install task configuration.

Also doLast for uploadArchives can be probably utilised.