@@ -19,6 +19,7 @@ repositories {
1919 // Use jcenter for resolving your dependencies.
2020 // You can declare any Maven/Ivy/file repository here.
2121 jcenter()
22+ mavenCentral()
2223}
2324
2425dependencies {
@@ -69,7 +70,7 @@ publishing {
6970
7071 }
7172
72- mavenJava(MavenPublication ) {
73+ mavenJava(MavenPublication ) {
7374 customizePom(pom)
7475 groupId ' com.microsoft.graph'
7576 artifactId ' microsoft-graph'
@@ -80,10 +81,10 @@ publishing {
8081 writeTo(pomFile)
8182 def pomAscFile = signing. sign(pomFile). signatureFiles[0 ]
8283 artifact(pomAscFile) {
83- classifier = null
84- extension = ' pom.asc'
85- }
86- }// pom.withXml
84+ classifier = null
85+ extension = ' pom.asc'
86+ }
87+ }
8788 artifact(sourceJar) {
8889 classifier = ' sources'
8990 }
@@ -92,29 +93,28 @@ publishing {
9293 }
9394 project. tasks. signArchives. signatureFiles. each {
9495 artifact(it) {
95- def matcher = it. file =~ / -(sources|javadoc)\. jar\. asc$/
96+ def matcher = it. file =~ / -(sources|javadoc)\. jar\. asc$/
9697 if (matcher. find()){
9798 classifier = matcher. group(1 )
9899 }
99100 else {
100101 classifier = null
101102 }
102103 extension = ' jar.asc'
103- }// artifact
104+ }
104105 }
105- }// mavenJava
106-
107- }// publications
106+ }
107+ }
108108 repositories {
109109 maven {
110- url " https://oss.sonatype.org/service/local/staging/deploy/maven2 "
110+ url " https://oss.sonatype.org/content/repositories/snapshots "
111111 credentials {
112- username sonatypeUsername
113- password sonatypePassword
112+ username = project . property( ' sonatypeUsername' )
113+ password = project . property( ' sonatypePassword' )
114114 }
115115 }
116116 }
117- }// publishing
117+ }
118118
119119task sourceJar (type : Jar ) {
120120 classifier = ' sources'
@@ -203,12 +203,10 @@ def customizePom(pom) {
203203 pom. withXml {
204204 def root = asNode()
205205
206- // eliminate test-scoped dependencies (no need in maven central POMs)
207206 root. dependencies. removeAll { dep ->
208207 dep. scope == " test"
209208 }
210209
211- // add all items necessary for maven central publication
212210 root. children(). last() + {
213211 resolveStrategy = Closure . DELEGATE_FIRST
214212
@@ -232,14 +230,26 @@ def customizePom(pom) {
232230 }
233231 scm {
234232 url ' https://github.com/microsoftgraph/msgraph-sdk-java'
235- connection ' scm:git:git@ github.com: microsoftgraph/msgraph-sdk-java.git'
233+ connection ' scm:git:git:// github.com/ microsoftgraph/msgraph-sdk-java.git'
236234 developerConnection
' scm:git:ssh://[email protected] :microsoftgraph/msgraph-sdk-java.git' 237235 }
238236 developers {
239237 developer {
240- name ' Mautini '
238+ name ' Microsoft '
241239 }
242240 }
243241 }
244242 }
245243}
244+
245+ model {
246+ tasks. generatePomFileForMavenJavaPublication {
247+ destination = file(" $buildDir /generated-pom.xml" )
248+ }
249+ tasks. publishMavenJavaPublicationToMavenLocal {
250+ dependsOn project. tasks. signArchives
251+ }
252+ tasks. publishMavenJavaPublicationToMavenRepository {
253+ dependsOn project. tasks. signArchives
254+ }
255+ }
0 commit comments