11apply plugin : ' maven-publish'
22apply plugin : ' signing'
3+ apply plugin : " io.codearte.nexus-staging"
34
45publishing {
5- boolean snapshotPublication = rootProject . version . endsWith( " SNAPSHOT " )
6+ test
67
78 repositories {
89 maven {
9- def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots "
10- def releasesRepoUrl = " https://oss.sonatype.org/content/repositories/releases "
11- url = snapshotPublication ? snapshotsRepoUrl : releasesRepoUrl
10+ url = snapshot
11+ ? " https://oss.sonatype.org/content/repositories/snapshots "
12+ : " https://oss.sonatype.org/service/local/staging/deploy/maven2 "
1213 name = " Sonatype"
1314
1415 credentials {
15- def uName = " "
16- def passwd = " "
17- int r
18- def stream = new FileInputStream (fileOrTempFile(" .credentials/sonatype-username.cred" ))
19- while ((r = stream. read()) != -1 ) uName = (uName + (char ) r)
20- stream = new FileInputStream (fileOrTempFile(" .credentials/sonatype-password.cred" ))
21- while ((r = stream. read()) != -1 ) passwd = (passwd + (char ) r)
22-
23- username uName
24- password passwd
16+ username sonatypeUsername
17+ password sonatypePassword
2518 }
2619 }
2720 }
2821
2922 publications {
3023 mavenJava(MavenPublication ) {
31- artifactId = ' vban-api'
32- artifact jar
33- version = rootProject. version
34-
24+ artifactId = artifactName
25+ from components. java
26+
27+ artifact sourcesJar
28+ artifact javadocJar
29+
3530 pom {
36- name = " VBAN-API "
37- description = " Java Library for handling VB-Audio's VBAN API "
31+ name = projectName
32+ description = projectDescription
3833 inceptionYear = ' 2019'
3934
4035 licenses {
@@ -51,32 +46,24 @@ publishing {
5146 email = " burdoto@outlook.com"
5247 }
5348 }
54-
55- scm {
56- connection = ' scm:git:https://github.com/burdoto/VBAN-API/VBAN-API.git'
57- developerConnection = ' scm:git:git@github.com:burdoto/VBAN-API.git'
58- url = ' https://github.com/burdoto/VBAN-API'
59- }
60-
61- issueManagement {
62- system = ' GitHub'
63- url = ' https://github.com/burdoto/VBAN-API/issues'
64- }
6549 }
6650 }
6751 }
6852}
6953
54+ task generateGitHubPom (type : GenerateMavenPom ) {
55+ destination = " pom.xml"
56+ pom = publishing. publications. mavenJava. pom
57+ }
58+
7059signing {
71- if (new File (" .credentials/sonatype-password.cred" ). exists()) {
72- useGpgCmd()
73- for (def pub : publishing. publications)
74- sign pub
75- }
60+ useGpgCmd()
61+ sign publishing. publications. mavenJava
7662}
7763
78- static File fileOrTempFile (String name ) {
79- def file = new File (name)
80- if (file. exists()) return file
81- return File . createTempFile(name, " " )
64+ tasks. removeAll([promoteRepository, closeAndPromoteRepository, getStagingProfile])
65+
66+ nexusStaging {
67+ username sonatypeUsername
68+ password sonatypePassword
8269}
0 commit comments