@@ -28,6 +28,7 @@ apply plugin: 'idea'
28
28
apply plugin : ' eclipse'
29
29
apply plugin : ' groovy'
30
30
apply plugin : ' maven'
31
+ apply plugin : ' maven-publish'
31
32
apply plugin : ' signing'
32
33
apply plugin : ' com.jfrog.bintray'
33
34
apply plugin : ' com.gradle.plugin-publish'
@@ -87,66 +88,72 @@ task javadocJar(type: Jar, dependsOn:javadoc) {
87
88
from javadoc. destinationDir
88
89
}
89
90
90
- artifacts {
91
- archives sourcesJar
92
- archives groovydocJar
93
- archives javadocJar
94
- }
95
-
96
91
codenarc {
97
92
toolVersion = " 1.4"
98
93
}
99
94
100
- // The Gradle plugin portal doesn't allow signature files.
101
- if (! gradle. startParameter. taskNames. intersect([' publishPlugins' ])) {
102
- signing {
103
- required { isReleaseVersion }
104
- sign configurations. archives
105
- }
106
- }
107
-
108
95
sourceCompatibility = JavaVersion . VERSION_1_7
109
96
targetCompatibility = JavaVersion . VERSION_1_7
110
97
111
- uploadArchives {
112
- repositories {
113
- mavenDeployer {
114
- beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
115
- repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
116
- if (rootProject. hasProperty(" ossrhUsername" ) && rootProject. hasProperty(" ossrhPassword" )) {
117
- authentication(userName : ossrhUsername, password : ossrhPassword)
118
- }
119
- }
120
- snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
121
- if (rootProject. hasProperty(" ossrhUsername" ) && rootProject. hasProperty(" ossrhPassword" )) {
122
- authentication(userName : ossrhUsername, password : ossrhPassword)
123
- }
124
- }
125
- pom. project {
126
- name project. name
127
- description " Gradle build plugin to handle Protocol Buffers automated code generation and compilation"
128
- url " https://github.com/google/protobuf-gradle-plugin"
98
+ tasks. withType(GenerateModuleMetadata ) {
99
+ enabled = false
100
+ }
101
+
102
+ publishing {
103
+ publications {
104
+ pluginMaven(MavenPublication ) {
105
+ artifact sourcesJar
106
+ artifact groovydocJar
107
+ artifact javadocJar
108
+
109
+ pom {
110
+ name = project. name
111
+ description = " Gradle build plugin to handle Protocol Buffers automated code generation and compilation"
112
+ url = " https://github.com/google/protobuf-gradle-plugin"
129
113
licenses {
130
114
license {
131
- name " BSD 3-Clause"
132
- url " http://opensource.org/licenses/BSD-3-Clause"
115
+ name = " BSD 3-Clause"
116
+ url = " http://opensource.org/licenses/BSD-3-Clause"
133
117
}
134
118
}
135
119
developers {
136
120
developer {
137
- id " zhangkun83"
138
- name " Kun Zhang"
139
-
121
+ id = " zhangkun83"
122
+ name = " Kun Zhang"
123
+
140
124
}
141
125
}
142
126
scm {
143
- connection " scm:git:git://github.com/google/protobuf-gradle-plugin.git"
144
- developerConnection
" scm:git:[email protected] :google/protobuf-gradle-plugin.git"
145
- url " https://github.com/google/protobuf-gradle-plugin"
127
+ connection = " scm:git:git://github.com/google/protobuf-gradle-plugin.git"
128
+ developerConnection
= " scm:git:[email protected] :google/protobuf-gradle-plugin.git"
129
+ url = " https://github.com/google/protobuf-gradle-plugin"
146
130
}
147
131
}
148
132
}
149
133
}
134
+
135
+ repositories {
136
+ maven {
137
+ String releaseUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
138
+ String snapshotUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
139
+ url = version. endsWith(' SNAPSHOT' ) ? snapshotUrl : releaseUrl
140
+
141
+ credentials {
142
+ if (rootProject. hasProperty(" ossrhUsername" ) && rootProject. hasProperty(" ossrhPassword" )) {
143
+ username = rootProject. ossrhUsername
144
+ password = rootProject. ossrhPassword
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ // The Gradle plugin portal doesn't allow signature files.
152
+ if (! gradle. startParameter. taskNames. intersect([' publishPlugins' ])) {
153
+ signing {
154
+ required { isReleaseVersion }
155
+ sign publishing. publications. pluginMaven
156
+ }
150
157
}
151
158
152
159
pluginBundle {
0 commit comments