@@ -6,6 +6,7 @@ plugins {
66 signing
77 id(" com.diffplug.eclipse.apt" ) version " 3.22.0"
88 id(" com.diffplug.gradle.spotless" ) version " 3.27.2"
9+ id(" de.marcphilipp.nexus-publish" ) version " 0.4.0"
910 id(" net.researchgate.release" ) version " 2.8.1"
1011}
1112
@@ -62,6 +63,13 @@ val processorSourcesJar by tasks.registering(Jar::class) {
6263 from(sourceSets.main.get().allSource)
6364}
6465
66+ val processorJavadocJar by tasks.registering(Jar ::class ) {
67+ dependsOn(javadoc)
68+ archiveAppendix.set(" processor" )
69+ archiveClassifier.set(" javadoc" )
70+ from(javadoc.get().destinationDir)
71+ }
72+
6573val build by tasks.existing {
6674 val publishToMavenLocal by tasks.existing
6775 dependsOn(publishToMavenLocal)
@@ -83,67 +91,52 @@ dependencies {
8391 testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.4.0" )
8492}
8593
94+ nexusPublishing {
95+ repositories {
96+ sonatype()
97+ }
98+ }
99+
86100publishing {
87101 publications {
88- val main = " main"
89- val processor = " processor"
90- create<MavenPublication >(main) {
102+ fun pomDefinition (publicationName : String ): MavenPom .() -> Unit {
103+ return {
104+ val projectUrl: String by project
105+ name.set(publicationName)
106+ description.set(" DAO Oriented Database Mapping Framework for Java 8+" )
107+ url.set(projectUrl)
108+ licenses {
109+ license {
110+ name.set(" The Apache Software License, Version 2.0" )
111+ url.set(" https://www.apache.org/licenses/LICENSE-2.0.txt" )
112+ }
113+ }
114+ developers {
115+ developer {
116+ id.set(" nakamura-to" )
117+ name.set(" Toshihiro Nakamura" )
118+ 119+ }
120+ }
121+ scm {
122+ val githubUrl: String by project
123+ connection.set(" scm:git:${githubUrl} " )
124+ developerConnection.set(" scm:git:${githubUrl} " )
125+ url.set(projectUrl)
126+ }
127+ }
128+ }
129+ create<MavenPublication >(" main" ) {
91130 from(components[" java" ])
92- pom(pomDefinition(main))
93- repositories(repositoriesDefinition())
131+ pom(pomDefinition(name))
94132 }
95- create<MavenPublication >(processor) {
96- pom(pomDefinition(processor ))
133+ create<MavenPublication >(" processor" ) {
134+ pom(pomDefinition(name ))
97135 val jar = processorJar.get()
98- val sourcesJar = processorSourcesJar.get()
99136 artifactId = " ${jar.archiveBaseName.get()} -${jar.archiveAppendix.get()} "
100137 artifact(jar)
101- artifact(sourcesJar)
102- repositories(repositoriesDefinition())
103- }
104- }
105- }
106-
107- fun pomDefinition (publicationName : String ): MavenPom .() -> Unit {
108- return {
109- val projectUrl: String by project
110- name.set(publicationName)
111- description.set(" DAO Oriented Database Mapping Framework for Java 8+" )
112- url.set(projectUrl)
113- licenses {
114- license {
115- name.set(" The Apache Software License, Version 2.0" )
116- url.set(" https://www.apache.org/licenses/LICENSE-2.0.txt" )
117- }
118- }
119- developers {
120- developer {
121- id.set(" nakamura-to" )
122- name.set(" Toshihiro Nakamura" )
123- 124- }
125- }
126- scm {
127- val githubUrl: String by project
128- connection.set(" scm:git:${githubUrl} " )
129- developerConnection.set(" scm:git:${githubUrl} " )
130- url.set(projectUrl)
131- }
132- }
133- }
134-
135- fun repositoriesDefinition (): RepositoryHandler .() -> Unit {
136- return {
137- maven {
138- val sonatypeSnapshotUrl: String by project
139- val sonatypeUrl: String by project
140- val sonatypeUsername: String by project
141- val sonatypePassword: String by project
142- url = uri(if (isSnapshot) sonatypeSnapshotUrl else sonatypeUrl)
143- credentials {
144- username = sonatypeUsername
145- password = sonatypePassword
146- }
138+ artifact(processorSourcesJar.get())
139+ artifact(processorJavadocJar.get())
147140 }
148141 }
149142}
0 commit comments