Hunter0x7c7
2024-11-21 979ae7c9ffb06359a15b633ab009773f5c964dd5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//配置Maven私服
apply plugin: 'maven'
//引入配置文件
Properties props = new Properties()
props.load(new FileInputStream(file("maven_config.properties")))
 
def getUserName() {
    return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
 
def getPassword() {
    return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
 
def coreAarFile = file('build/outputs/aar/' + props['AAR_FILE_NAME'])
 
uploadArchives {
    repositories.mavenDeployer {
        repository(url: NEXUS_REPOSITORY_URL) {
            authentication(userName: getUserName(), password: getPassword())
        }
        pom.project {
            name props['POM_NAME']
            version props['POM_VERSION']
            artifactId props['POM_ARTIFACT_ID']
            groupId POM_GROUP_ID
            packaging props['POM_PACKAGING']
            description props['POM_DESCRIPTION']
        }
        task androidSourcesJar(type: Jar) {
            classifier = 'sources'
            from file(coreAarFile)
        }
 
        artifacts {
            archives androidSourcesJar
        }
    }
}