@@ -25,22 +25,18 @@ artifacts {
2525 archives sourcesJar, javadocJar
2626}
2727
28-
29- final releaseRepositoryUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
30- final snapshotRepositoryUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
31-
3228publishing {
3329 publications {
3430 mavenJava(MavenPublication ) {
31+ from components. java
32+
33+ artifact sourcesJar
34+ artifact javadocJar
3535
3636 groupId = GROUP
3737 artifactId = POM_ARTIFACT_ID
3838 version = getVersionName()
3939
40- artifact(" $buildDir /libs/${ project.name} -${ version} .jar" )
41- artifact sourcesJar
42- artifact javadocJar
43-
4440 pom {
4541 name = POM_NAME
4642 packaging = POM_PACKAGING
@@ -68,28 +64,18 @@ publishing {
6864 connection = POM_SCM_CONNECTION
6965 developerConnection = POM_SCM_DEV_CONNECTION
7066 }
71-
72- pom. withXml {
73- def dependenciesNode = asNode(). appendNode(' dependencies' )
74-
75- project. configurations. implementation. allDependencies. each {
76- def dependencyNode = dependenciesNode. appendNode(' dependency' )
77- dependencyNode. appendNode(' groupId' , it. group)
78- dependencyNode. appendNode(' artifactId' , it. name)
79- dependencyNode. appendNode(' version' , it. version)
80- }
81- }
8267 }
8368 }
8469 }
70+ }
71+
72+ nexusPublishing {
8573 repositories {
86- maven {
87- name = " sonatype"
88- url = version. endsWith(' SNAPSHOT' ) ? snapshotRepositoryUrl : releaseRepositoryUrl
89- credentials {
90- username = System . getenv(" MAVEN_USERNAME" )
91- password = System . getenv(" MAVEN_PASSWORD" )
92- }
74+ sonatype {
75+ nexusUrl. set(uri(' https://ossrh-staging-api.central.sonatype.com/service/local/' ))
76+ snapshotRepositoryUrl. set(uri(' https://central.sonatype.com/repository/maven-snapshots/' ))
77+ username. set(System . getenv(" MAVEN_USERNAME" ))
78+ password. set(System . getenv(" MAVEN_PASSWORD" ))
9379 }
9480 }
9581}
0 commit comments