|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
| 17 | +plugins { |
| 18 | + // https://github.com/ben-manes/gradle-versions-plugin/releases |
| 19 | + id("com.github.ben-manes.versions") version "0.46.0" |
| 20 | + // https://github.com/gradle-nexus/publish-plugin/releases |
| 21 | + id("io.github.gradle-nexus.publish-plugin") version "1.3.0" |
| 22 | +} |
| 23 | + |
| 24 | + |
17 | 25 | allprojects { |
18 | 26 | apply plugin: 'eclipse' |
19 | 27 | apply plugin: 'jacoco' |
20 | 28 | apply plugin: 'java-library' |
21 | | - apply plugin: 'maven' |
22 | | - apply plugin: 'signing' |
23 | 29 |
|
24 | 30 | group = 'com.google.endpoints' |
25 | 31 |
|
26 | 32 | java { |
27 | 33 | toolchain { |
28 | 34 | languageVersion = JavaLanguageVersion.of(8) |
29 | 35 | } |
| 36 | + withJavadocJar() |
| 37 | + withSourcesJar() |
30 | 38 | } |
31 | 39 |
|
32 | 40 | jacocoTestReport { |
@@ -78,88 +86,20 @@ subprojects { |
78 | 86 | } |
79 | 87 | } |
80 | 88 |
|
81 | | -def configureMaven(project, projectName, projectDescription) { |
82 | | - configure(project) { |
83 | | - task javadocJar(type: Jar) { |
84 | | - classifier = 'javadoc' |
85 | | - from javadoc |
86 | | - } |
87 | | - |
88 | | - task sourcesJar(type: Jar) { |
89 | | - classifier = 'sources' |
90 | | - from sourceSets.main.allSource |
91 | | - } |
92 | | - |
93 | | - artifacts { |
94 | | - archives javadocJar, sourcesJar |
95 | | - } |
96 | | - |
97 | | - signing { |
98 | | - required false |
99 | | - sign configurations.archives |
100 | | - } |
101 | | - |
102 | | - uploadArchives { |
103 | | - repositories { |
104 | | - mavenDeployer { |
105 | | - def tmpSnapshotRepo = "http://104.197.230.53:8081/nexus/content/repositories/snapshots/" |
106 | | - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } |
107 | | - |
108 | | - String stagingUrl |
109 | | - if (rootProject.hasProperty('repositoryId')) { |
110 | | - stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + |
111 | | - rootProject.repositoryId |
112 | | - } else { |
113 | | - stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' |
114 | | - } |
115 | | - def configureAuth = { |
116 | | - if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) { |
117 | | - authentication(userName: rootProject.ossrhUsername, password: rootProject.ossrhPassword) |
118 | | - } |
119 | | - } |
120 | | - repository(url: stagingUrl, configureAuth) |
121 | | - snapshotRepository(url: tmpSnapshotRepo) { |
122 | | - authentication(userName: privateOssrhUsername, password: privateOssrhPassword) |
123 | | - } |
124 | | - |
125 | | - pom.project { |
126 | | - name projectName |
127 | | - description projectDescription |
128 | | - packaging 'jar' |
129 | | - url 'https://cloud.google.com/endpoints/docs/frameworks/java' |
130 | | - |
131 | | - scm { |
132 | | - connection 'scm:git:https://github.com/cloudendpoints/endpoints-management-java' |
133 | | - developerConnection 'scm:git:https://github.com/cloudendpoints/endpoints-management-java' |
134 | | - url 'scm:git:https://github.com/cloudendpoints/endpoints-management-java' |
135 | | - } |
136 | | - |
137 | | - licenses { |
138 | | - license { |
139 | | - name 'The Apache License, Version 2.0' |
140 | | - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
141 | | - } |
142 | | - } |
143 | | - |
144 | | - developers { |
145 | | - developer { |
146 | | - id 'temiola@google.com' |
147 | | - name 'Tim Emiola' |
148 | | - email 'temiola@google.com' |
149 | | - organization = "Google, Inc." |
150 | | - organizationUrl "https://www.google.com" |
151 | | - } |
152 | | - developer { |
153 | | - id 'yangguan@google.com' |
154 | | - name 'Yang Guan' |
155 | | - email 'yangguan@google.com' |
156 | | - organization = "Google, Inc." |
157 | | - organizationUrl "https://www.google.com" |
158 | | - } |
159 | | - } |
160 | | - } |
161 | | - } |
| 89 | +// Plugin to publish to Central https://github.com/gradle-nexus/publish-plugin/ |
| 90 | +// This plugin ensures a separate, named staging repo is created for each build when publishing. |
| 91 | +nexusPublishing { |
| 92 | + packageGroup.set("com.uwetrottmann") |
| 93 | + repositories { |
| 94 | + sonatype { |
| 95 | + if (project.hasProperty("SONATYPE_NEXUS_USERNAME") && project.hasProperty("SONATYPE_NEXUS_PASSWORD")) { |
| 96 | + println("nexusPublishing credentials supplied.") |
| 97 | + username.set(project.property("SONATYPE_NEXUS_USERNAME").toString()) |
| 98 | + password.set(project.property("SONATYPE_NEXUS_PASSWORD").toString()) |
| 99 | + } else { |
| 100 | + println("nexusPublishing credentials NOT supplied.") |
162 | 101 | } |
163 | 102 | } |
164 | 103 | } |
165 | 104 | } |
| 105 | + |
0 commit comments