159 lines
3.4 KiB
Groovy
159 lines
3.4 KiB
Groovy
/**
|
||
* junbo nexus的用户名,请先向运维部申请账号密码
|
||
* 然后在 gradle根目录/init.d/ 下建立 init.gradle文件
|
||
* 在文件中加入
|
||
<code>
|
||
ext {nexus = 'http://nexus.jetmobo.com/'
|
||
username = '用户名'
|
||
password = '密码' }</>
|
||
* @return junbo nexus的用户名
|
||
*/
|
||
String getJunboMavenUserName() {
|
||
return gradle.ext.username
|
||
}
|
||
|
||
|
||
/**
|
||
* junbo nexus的密码,请先向运维部申请账号密码
|
||
* 然后在 gradle根目录/init.d/ 下建立 init.gradle文件
|
||
* 在文件中加入
|
||
<code>
|
||
ext {nexus = 'http://nexus.jetmobo.com/'
|
||
username = '用户名'
|
||
password = '密码' }</>
|
||
* @return junbo nexus的密码
|
||
*/
|
||
String getJunboMavenUserPwd() {
|
||
return gradle.ext.password
|
||
}
|
||
|
||
/**
|
||
* junbo nexus的根url,请先向运维部申请账号密码
|
||
* 然后在 gradle根目录/init.d/ 下建立 init.gradle文件
|
||
* 在文件中加入
|
||
<code>
|
||
ext {nexus = 'http://nexus.jetmobo.com/'
|
||
username = '用户名'
|
||
password = '密码' }</>
|
||
* @return junbo nexus的根url
|
||
*/
|
||
String getJunboMavenRoot() {
|
||
return gradle.ext.nexus
|
||
}
|
||
|
||
String getJunboPublicUrl() {
|
||
return getJunboMavenRoot() + 'repository/public/'
|
||
}
|
||
|
||
String getJunboSnapshotUrl() {
|
||
return getJunboMavenRoot() + 'repository/Snapshots/'
|
||
}
|
||
|
||
String getJunboReleaseUrl() {
|
||
return getJunboMavenRoot() + 'repository/Releases/'
|
||
}
|
||
|
||
static String getAliPublicUrl() {
|
||
return 'https://maven.aliyun.com/nexus/content/groups/public'
|
||
}
|
||
|
||
static String getMavenCenterUrl() {
|
||
return 'https://repo.maven.apache.org/maven2'
|
||
}
|
||
|
||
String getJunboPublishUrl() {
|
||
if (ext.isSnapshot) {
|
||
return getJunboSnapshotUrl()
|
||
} else {
|
||
return getJunboReleaseUrl()
|
||
}
|
||
}
|
||
|
||
|
||
repositories {
|
||
mavenLocal()
|
||
|
||
maven {
|
||
url getJunboPublicUrl()
|
||
allowInsecureProtocol = true
|
||
credentials {
|
||
username getJunboMavenUserName()
|
||
password getJunboMavenUserPwd()
|
||
}
|
||
}
|
||
|
||
maven {
|
||
url getJunboReleaseUrl()
|
||
allowInsecureProtocol = true
|
||
credentials {
|
||
username getJunboMavenUserName()
|
||
password getJunboMavenUserPwd()
|
||
}
|
||
}
|
||
|
||
maven {
|
||
url getJunboSnapshotUrl()
|
||
allowInsecureProtocol = true
|
||
credentials {
|
||
username getJunboMavenUserName()
|
||
password getJunboMavenUserPwd()
|
||
}
|
||
}
|
||
|
||
maven {
|
||
url getAliPublicUrl()
|
||
}
|
||
|
||
maven {
|
||
url getMavenCenterUrl()
|
||
}
|
||
|
||
mavenCentral()
|
||
}
|
||
|
||
tasks.withType(JavaCompile) {
|
||
options.encoding = 'UTF-8'
|
||
}
|
||
|
||
javadoc {
|
||
options {
|
||
encoding "UTF-8"
|
||
charSet 'UTF-8'
|
||
author true
|
||
version true
|
||
links "http://docs.oracle.com/javase/7/docs/api"
|
||
failOnError false
|
||
}
|
||
}
|
||
|
||
task sourceJar(type: Jar) {
|
||
archiveClassifier.convention('sources')
|
||
archiveClassifier.set('sources')
|
||
from(sourceSets.main.allJava)
|
||
}
|
||
|
||
task testJar(type: Jar) {
|
||
archiveClassifier.convention('testSources')
|
||
archiveClassifier.set('testSources')
|
||
from(sourceSets.test.allJava)
|
||
}
|
||
|
||
publishing {
|
||
publications {
|
||
common(MavenPublication) {
|
||
from(components.java)
|
||
artifact(sourceJar)
|
||
artifact(testJar)
|
||
}
|
||
}
|
||
|
||
repositories {
|
||
maven {
|
||
url getJunboPublishUrl()
|
||
credentials {
|
||
username getJunboMavenUserName()
|
||
password getJunboMavenUserPwd()
|
||
}
|
||
}
|
||
}
|
||
} |