From a6f18e34cc80bf9e243e87a0249b715c04de3710 Mon Sep 17 00:00:00 2001 From: alan3058 <361225485@qq.com> Date: Wed, 3 Jan 2018 13:10:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E5=B8=83=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.gradle | 118 ++++++++++++++++++++++++++++++++++++++++++++++ gradle.properties | 31 ++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 deploy.gradle create mode 100644 gradle.properties diff --git a/deploy.gradle b/deploy.gradle new file mode 100644 index 0000000..3edbdb7 --- /dev/null +++ b/deploy.gradle @@ -0,0 +1,118 @@ +apply from: 'build.gradle' + +apply plugin: 'maven' +apply plugin: 'signing' + +def isReleaseBuild() { + return VERSION_NAME.contains("SNAPSHOT") == false +} + +def getReleaseRepositoryUrl() { + return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL + : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +} + +def getSnapshotRepositoryUrl() { + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" +} + +def getRepositoryUsername() { + return hasProperty('MAVEN_USERNAME') ? MAVEN_USERNAME : "" +} + +def getRepositoryPassword() { + return hasProperty('MAVEN_PASSWORD') ? MAVEN_PASSWORD : "" +} + +uploadArchives { + repositories { + mavenDeployer { + configurePOM(pom) + + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: getReleaseRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + snapshotRepository(url: getSnapshotRepositoryUrl()) { + authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) + } + } + } +} + +signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives +} + +javadoc { + failOnError false + options{ + encoding "UTF-8" + charSet 'UTF-8' + author true + version true + links "http://docs.oracle.com/javase/7/docs/api" + title 'ctosb core document' + } +} +task javadocsJar(type: Jar,dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource +} + + +artifacts { + archives jar + archives javadocsJar + archives sourcesJar +} + +private configurePOM(def pom) { + pom.project { + groupId POM_GROUP_ID + artifactId POM_ARTIFACT_ID + version VERSION_NAME + name POM_NAME + packaging POM_PACKAGING + description POM_DESCRIPTION + url POM_URL + inceptionYear POM_INCEPTION_YEAR + + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + comments POM_LICENCE_COMMENTS + } + } + + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + email POM_DEVELOPER_EMAIL + url POM_DEVELOPER_URL + } + } + + issueManagement { + system POM_ISSUE_MANAGEMENT_SYSTEM + url POM_ISSUE_MANAGEMENT_URL + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..28487d8 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,31 @@ +POM_GROUP_ID=com.ctosb +POM_DESCRIPTION=ctosb codebuild web +POM_URL=https://github.com/Alan3058/ctosb-codebuild-web +POM_SCM_URL=https://github.com/Alan3058/ctosb-codebuild-web +POM_SCM_CONNECTION=scm:git@github.com:Alan3058/ctosb-codebuild-web.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:Alan3058/ctosb-codebuild-web.git +POM_LICENCE_COMMENTS=A business-friendly OSS license +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo +POM_DEVELOPER_ID=wen3058 +POM_DEVELOPER_NAME=liliangang +POM_DEVELOPER_EMAIL=361225485@qq.com +POM_DEVELOPER_URL=http://www.ctosb.com +POM_ISSUE_MANAGEMENT_SYSTEM=Github +POM_ISSUE_MANAGEMENT_URL=https://github.com/Alan3058/ctosb-codebuild-web/issues +POM_INCEPTION_YEAR=2017 + +POM_NAME=ctosb codebuild web +POM_ARTIFACT_ID=ctosb-codebuild-web +POM_PACKAGING=jar + +VERSION_NAME=1.0.0-SNAPSHOT +VERSION_CODE=1 + +#全局隐私配置,移植到本地目录 +#signing.keyId=xxxx +#signing.password=xxxx +#signing.secretKeyRingFile=C:/Users/dell/AppData/Roaming/gnupg/secring.gpg +#MAVEN_USERNAME=xxx +#MAVEN_PASSWORD=xxxx