apply plugin: 'maven' Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) uploadArchives { repositories { mavenDeployer { repository(url: properties.getProperty("POM_URL")) { authentication(userName: properties.getProperty("nexus.user"), password: properties.getProperty("nexus.password")) } // pom.groupId = properties.getProperty("POM_GROUP_ID") pom.artifactId = properties.getProperty("POM_ATRIFACT_ID") pom.version = properties.getProperty("POM_VERSION") pom.project { licenses { license { name 'The Apache Software License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } } // pom.project { // version properties.getProperty("POM_VERSION") // artifactId properties.getProperty("POM_ATRIFACT_ID") // groupId properties.getProperty("POM_GROUP_ID") // packaging 'aar' // description properties.getProperty("POM_DESCRIPTION") // licenses { // license { // name 'The Apache Software License, Version 2.0' // url 'http://www.apache.org/licenses/LICENSE-2.0.txt' // } // } // } } } } //gradlew uploadArchives terminal中输入