Skip to content

Commit 1dee3f5

Browse files
committed
fix for publishing
1 parent 590c2e7 commit 1dee3f5

File tree

4 files changed

+308
-34
lines changed

4 files changed

+308
-34
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ Thumbs.db
33
.gradle/
44
.git/
55
build/
6-
.idea
6+
.idea/
77
*.iml
88
*.ipr
99
*.iws
1010
.project
1111
.settings
1212
.classpath
1313
.bin
14+
gradle.properties

build.gradle

+127-29
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,69 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal() {
4+
metadataSources {
5+
mavenPom()
6+
artifact()
7+
}
8+
}
9+
mavenCentral()
10+
}
11+
dependencies {
12+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
13+
classpath("io.github.gradle-nexus:publish-plugin:1.0.0")
14+
}
15+
}
16+
17+
118
plugins {
2-
id 'org.springframework.boot'
3-
id 'io.spring.dependency-management'
19+
id 'org.springframework.boot' version "${springBootVersion}"
20+
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
21+
//id "signing"
422
id 'maven-publish'
23+
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
524
id 'groovy'
625
}
726

27+
828
apply plugin: "maven-publish"
29+
apply plugin: 'signing'
30+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
31+
apply plugin: 'groovy'
32+
apply plugin: 'io.spring.dependency-management'
933

10-
//archivesBaseName = 'beapi-spring-boot-autoconfigure'
1134

12-
java {
13-
withSourcesJar()
14-
}
35+
description = "The Beapi Springboot Starter for API Automation; automates and simplifies almost all API functionality and security"
1536

16-
description = "Starter for using Beapi's blah blah blah ..."
37+
//archivesBaseName = 'beapi-spring-boot-autoconfigure'
1738

1839
bootJar {
1940
enabled = false
2041
}
2142

22-
group = "${group}"
43+
group = "io.beapi"
44+
archivesBaseName = "spring-boot-starter-beapi"
2345
version = "${version}"
2446

2547
sourceCompatibility = "${sourceCompatibility}"
2648

49+
publishing {
50+
publications {
51+
maven(MavenPublication) {
52+
from(components.java)
53+
}
54+
}
55+
}
56+
57+
58+
java {
59+
withJavadocJar()
60+
withSourcesJar()
61+
}
62+
63+
repositories {
64+
mavenCentral()
65+
}
66+
2767
dependencies {
2868

2969
implementation("org.springframework.boot:spring-boot-starter:${springBootVersion}"){
@@ -45,7 +85,7 @@ dependencies {
4585
//implementation 'org.projectlombok:lombok:1.18.20'
4686
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
4787
implementation 'org.json:json:20210307'
48-
implementation 'com.google.code.gson:gson:2.8.8'
88+
implementation 'com.google.code.gson:gson:2.8.9'
4989

5090
// LOGGING
5191
//implementation 'org.slf4j:slf4j-api:1.7.15'
@@ -54,7 +94,7 @@ dependencies {
5494
// SECURITY
5595
implementation "org.springframework.boot:spring-boot-starter-security:${springBootVersion}"
5696
implementation "com.fasterxml.jackson.core:jackson-core:2.12.0"
57-
implementation "com.fasterxml.jackson.core:jackson-databind:2.12.0"
97+
implementation "com.fasterxml.jackson.core:jackson-databind:2.13.1"
5898
implementation 'io.jsonwebtoken:jjwt:0.9.1'
5999

60100
// LOGGING FOR GRAFANA/ GRAPHITE / CARBON
@@ -102,32 +142,90 @@ dependencies {
102142

103143
}
104144

105-
afterEvaluate {
106-
107-
println("Components: " + components*.name)
108-
println("project : ${rootProject.name}/${project.name}")
109145

110-
publishing {
111-
repositories {
112-
maven {
113-
//name = "spring-boot-starter-beapi"
114-
url = "https://maven.pkg.github.com/orubel/spring-boot-starter-beapi"
115-
credentials {
116-
username = 'orubel'
117-
password = System.getenv("GITHUB_TOKEN")
146+
project.plugins.withType(MavenPublishPlugin).all {
147+
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
148+
publishing.publications.withType(MavenPublication).all { mavenPublication ->
149+
mavenPublication.pom {
150+
name = "${project.group}:${project.name}"
151+
description = "The Beapi Springboot Starter for API Automation; automates and simplifies almost all API functionality and security"
152+
url = "https://github.com/orubel/spring-boot-starter-beapi"
153+
licenses {
154+
license {
155+
name = "Reciprocal Public License (RPL-1.5)"
156+
url = "https://opensource.org/licenses/RPL-1.5"
118157
}
119158
}
120-
}
121-
publications {
122-
gpr(MavenPublication) {
123-
//groupId = 'io.beapi'
124-
//artifactId = 'spring-boot-starter-beapi'
125-
//version = version
126-
from project.components.java
159+
developers {
160+
developer {
161+
id = "orubel"
162+
name = "Owen Rubel"
163+
email = "orubel+spam@gmail.com"
164+
}
165+
}
166+
scm {
167+
connection = "https://github.com/orubel/spring-boot-starter-beapi.git"
168+
developerConnection = "https://github.com/orubel/spring-boot-starter-beapi.git"
169+
url = "https://github.com/orubel/spring-boot-starter-beapi"
127170
}
128171
}
129172
}
173+
}
130174

175+
nexusPublishing {
176+
repositories {
177+
sonatype {
178+
username = System.getenv("ORG_GRADLE_PROJECT_ossrhUsername")
179+
password = System.getenv("ORG_GRADLE_PROJECT_ossrhPassword")
180+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
181+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
182+
}
183+
}
184+
185+
// these are not strictly required. The default timeouts are set to 1 minute. But Sonatype can be really slow.
186+
// If you get the error "java.net.SocketTimeoutException: timeout", these lines will help.
187+
connectTimeout = Duration.ofMinutes(3)
188+
clientTimeout = Duration.ofMinutes(3)
189+
}
190+
191+
192+
193+
//artifacts {
194+
// archives javadocJar, sourcesJar
195+
//}
196+
197+
//signing {
198+
// sign project.configurations.archives
199+
//}
200+
201+
//task javadocJar(type: Jar) {
202+
// classifier = 'javadoc'
203+
// from javadoc
204+
//}
205+
206+
//task sourcesJar(type: Jar) {
207+
// classifier = 'sources'
208+
// from sourceSets.main.allSource
209+
//}
210+
211+
def hasSigningKey = System.getenv("ORG_GRADLE_PROJECT_signingKeyId") || System.getenv("ORG_GRADLE_PROJECT_signingKey")
212+
if(hasSigningKey) {
213+
sign(project)
214+
}
215+
void sign(Project project) {
216+
project.signing {
217+
required { project.gradle.taskGraph.hasTask("publish") }
218+
def signingKeyId = findProperty("signingKeyId")
219+
def signingKey = findProperty("signingKey")
220+
def signingPassword = findProperty("signingPassword")
221+
222+
if (signingKeyId) {
223+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
224+
} else if (signingKey) {
225+
useInMemoryPgpKeys(signingKey, signingPassword)
226+
}
227+
sign publishing.publications.maven
228+
}
131229
}
132230

133231

build.gradle.bkp2

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal() {
4+
metadataSources {
5+
mavenPom()
6+
artifact()
7+
}
8+
}
9+
mavenCentral()
10+
}
11+
dependencies {
12+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
13+
classpath("io.github.gradle-nexus:publish-plugin:1.0.0")
14+
// classpath group: 'org.codehaus.gpars', name: 'gpars', version: '1.2.1'
15+
}
16+
}
17+
18+
19+
plugins {
20+
id 'org.springframework.boot' version "${springBootVersion}"
21+
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
22+
id "signing"
23+
id 'maven-publish'
24+
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
25+
id 'groovy'
26+
}
27+
28+
29+
apply plugin: 'signing'
30+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
31+
32+
apply plugin: 'groovy'
33+
apply plugin: 'io.spring.dependency-management'
34+
35+
apply plugin: "maven-publish"
36+
37+
description = "The Beapi Springboot Starter for API Automation; automates and simplifies almost all API functionality and security"
38+
39+
//archivesBaseName = 'beapi-spring-boot-autoconfigure'
40+
41+
bootJar {
42+
enabled = false
43+
}
44+
45+
group = "io.beapi"
46+
archivesBaseName = "spring-boot-starter-beapi"
47+
version = "${version}"
48+
49+
sourceCompatibility = "${sourceCompatibility}"
50+
51+
/*
52+
publishing {
53+
publications {
54+
maven(MavenPublication) {
55+
from(components.java)
56+
}
57+
}
58+
}
59+
60+
*/
61+
62+
java {
63+
withJavadocJar()
64+
withSourcesJar()
65+
}
66+
67+
repositories {
68+
mavenCentral()
69+
}
70+
71+
dependencies {
72+
73+
implementation("org.springframework.boot:spring-boot-starter:${springBootVersion}"){
74+
exclude group:'org.springframework.boot', module:'spring-boot-starter-logging'
75+
}
76+
77+
// Gradle 4.6 and later
78+
annotationProcessor "org.springframework.boot:spring-boot-autoconfigure-processor:${springBootVersion}"
79+
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}"
80+
implementation "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
81+
implementation "org.springframework.boot:spring-boot:${springBootVersion}"
82+
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
83+
implementation("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
84+
85+
//implementation("org.springframework.boot:spring-boot-starter-web:${springBootVersion}"){
86+
// exclude group:'org.springframework', module:'spring-web'
87+
//}
88+
89+
//implementation 'org.projectlombok:lombok:1.18.20'
90+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
91+
implementation 'org.json:json:20210307'
92+
implementation 'com.google.code.gson:gson:2.8.9'
93+
94+
// LOGGING
95+
//implementation 'org.slf4j:slf4j-api:1.7.15'
96+
runtimeOnly 'org.slf4j:slf4j-api:1.7.15'
97+
98+
// SECURITY
99+
implementation "org.springframework.boot:spring-boot-starter-security:${springBootVersion}"
100+
implementation "com.fasterxml.jackson.core:jackson-core:2.12.0"
101+
implementation "com.fasterxml.jackson.core:jackson-databind:2.13.1"
102+
implementation 'io.jsonwebtoken:jjwt:0.9.1'
103+
104+
// LOGGING FOR GRAFANA/ GRAPHITE / CARBON
105+
implementation "io.micrometer:micrometer-registry-graphite:1.3.0"
106+
107+
// GROOVY
108+
implementation("org.codehaus.groovy:groovy-ant"){
109+
exclude group:'org.codehaus.groovy', module: 'groovy-all'
110+
}
111+
implementation('org.codehaus.groovy:groovy-json:2.5.4'){
112+
exclude group:'org.codehaus.groovy', module: 'groovy-all'
113+
}
114+
implementation('org.codehaus.gpars:gpars:1.2.1'){
115+
exclude group:'org.multiverse', module:'multiverse-core'
116+
exclude group:'org.codehaus.groovy', module: 'groovy-all'
117+
}
118+
119+
// IOUTILS
120+
implementation 'commons-io:commons-io:2.8.0'
121+
122+
implementation "org.springframework.boot:spring-boot-starter-validation:${springBootVersion}"
123+
124+
implementation('org.projectlombok:lombok:1.18.2')
125+
annotationProcessor 'org.projectlombok:lombok:1.18.2'
126+
127+
// CACHING
128+
implementation 'org.springframework:spring-context-support:5.3.3'
129+
implementation 'org.springframework.boot:spring-boot-starter-cache:2.7.0'
130+
implementation 'org.hibernate:hibernate-ehcache:5.4.15.Final'
131+
implementation group: 'com.google.guava', name: 'guava', version: '14.0'
132+
133+
// FOR NONNULL ANNOTATION
134+
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
135+
136+
//compileOnly('org.projectlombok:lombok:1.18.2')
137+
138+
// TEST
139+
//implementation('org.springframework:spring-test:5.3.20')
140+
//testImplementation('org.spockframework:spock-core:2.0-M3-groovy-3.0')
141+
//testImplementation('org.spockframework:spock-spring:2.0-M3-groovy-3.0')
142+
//testImplementation('org.springframework.boot:spring-boot-starter-test') {
143+
// exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
144+
//}
145+
implementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
146+
147+
}
148+
149+
import com.vanniktech.maven.publish.JavaLibrary
150+
import com.vanniktech.maven.publish.JavadocJar
151+
152+
mavenPublishing {
153+
// available options:
154+
// - JavaLibrary
155+
// - GradlePlugin
156+
// - AndroidLibrary (deprecated)
157+
// - AndroidSingleVariantLibrary (requires AGP 7.1.1)
158+
// - AndroidMultiVariantLibrary (requires AGP 7.1.1)
159+
// first param configures the javadoc jar : [None,Empty,Javadoc]
160+
// second param is for whether to publish sources, optional, defaults to true
161+
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
162+
}
163+
164+
165+
signing {
166+
sign configurations.archives
167+
}
168+
169+
170+
171+
172+
173+
174+
175+
176+
177+
178+
179+

0 commit comments

Comments
 (0)