Skip to content

Commit e736c9c

Browse files
committed
MXTS-74974: modernize microdocs-core-java publishing, fix pre-existing -Werror warnings, update README
1 parent d7aebd5 commit e736c9c

8 files changed

Lines changed: 78 additions & 102 deletions

File tree

README.md

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,19 @@
22
This is the Java plugin to publish data to your [microdocs server](https://github.com/MaxxtonGroup/microdocs). For more info, see the three READMEs's in the subfolders.
33

44

5-
## Publishing to Maven Central
5+
## Publishing
66

7-
Before you can publish, you'll have to do some setup.
7+
Artifacts publish to Maxxton's internal Maven registry, not Maven Central - no GPG signing or Sonatype account needed.
88

9-
1. Create a [sonatype account](https://issues.sonatype.org/secure/Signup!default.jspa) and create an issue to request access to com.maxxton
10-
2. Install [GnuPG](https://www.gnupg.org/download/) NOTE: at least version 2.1!
11-
3. Generate key pair by running:
12-
```
13-
$ gpg --full-generate-key
14-
```
15-
Choose RSA 2048bit with no expiration. Fill in your name, email, and passphrase. Your key is saved in `~/.gnupg`.
16-
17-
18-
4. Run this to update your secring.gpg:
19-
```
20-
$ gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
21-
```
9+
`microdocs-crawler-gradle` and `microdocs-core-java` use the `com.maxxton.convention` plugin, which configures the publication and registry automatically. `microdocs-crawler-doclet` never publishes its own artifact - only its fat jar is bundled into `microdocs-crawler-gradle`'s published jar.
2210

23-
5. Create `~/.gradle/gradle.properties` (or `C:\\Users\\username\\.gradle\\gradle.properties`) with the following properties:
11+
To publish a new version:
12+
1. Bump `version` in `gradle.properties` for whichever module(s) changed.
13+
2. Run:
2414
```
25-
signing.keyId=keyid
26-
signing.password=yourpassword
27-
signing.secretKeyRingFile=C:\\Users\\username\\.gnupg\\secring.gpg
28-
29-
sonatypeUsername=username
30-
sonatypePassword=password
15+
$ ./publish.sh
3116
```
3217

33-
Use `gpg --list-secret-keys --keyid-format 0xshort` to get your keyId
34-
```
35-
% gpg --list-secret-keys --keyid-format 0xshort
36-
[keyboxd]
37-
---------
38-
sec rsa2048/0x1337CAFE 1970-01-01 [SC]
39-
^^^^^^^^^^
40-
## this bit is what you're looking for.
41-
1337133713371337133713371337133713371337
42-
uid [ultimate] Your Name <y.name@maxxton.com>
43-
ssb rsa2048/0xCAFE1337 1970-01-01 [E]
44-
```
45-
46-
6. Publish
47-
```
48-
$ ./publish
49-
```
50-
51-
And follow the [release and deployment manual](https://central.sonatype.org/pages/releasing-the-deployment.html)
52-
Check this link for more info on [the signing plugin](https://docs.gradle.org/current/userguide/signing_plugin.html)
53-
54-
5518
### Java 8
56-
Checkout the java8 branch for a Java 8 compatible version. The master branch will be based on Java 11, the difference is substantial due to the revised Javadoc API in since Java 9.
19+
Checkout the java8 branch for a Java 8 compatible version. The master branch is based on Java 21.
5720

microdocs-core-java/build.gradle

Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,16 @@
22
plugins {
33
id "java"
44
id "java-library"
5-
id "signing"
65
id "maven-publish"
7-
id "com.google.cloud.artifactregistry.gradle-plugin" version "2.2.0"
6+
id "com.maxxton.convention" version "3.3.2"
87
}
98

10-
group = 'com.maxxton'
11-
version = '4.0.0'
9+
// group and version come from gradle.properties, set before the
10+
// com.maxxton.convention plugin's PublishingConfiguration reads them.
1211

13-
publishing {
14-
publications {
15-
mavenJava(MavenPublication) {
16-
from components.java
17-
pom {
18-
name = 'MicroDocs Core Java'
19-
description = 'MicroDocs core functionalities to share accross various projects'
20-
url = 'https://github.com/MaxxtonGroup/microdocs'
21-
licenses {
22-
license {
23-
name = 'The Apache Software License, Version 2.0'
24-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
25-
distribution = 'repo'
26-
}
27-
}
28-
developers {
29-
developer {
30-
id = 's.hermans'
31-
name = 'Steven Hermans'
32-
}
33-
}
34-
scm {
35-
url = 'scm:git@github.com:MaxxtonGroup/microdocs.git'
36-
connection = 'scm:git@github.com:MaxxtonGroup/microdocs.git'
37-
developerConnection = 'scm:git@github.com:MaxxtonGroup/microdocs.git'
38-
}
39-
}
40-
}
41-
}
42-
repositories {
43-
// mavenLocal()
44-
maven {
45-
url "artifactregistry://europe-maven.pkg.dev/dynamic-concept-192711/maxxton-maven-registry"
46-
}
47-
}
48-
}
12+
// Publishing (mavenJava publication + maxxton-maven-registry repository) is
13+
// auto-configured by the com.maxxton.convention plugin once maven-publish
14+
// and java are detected - see PublishingConfiguration in maxxton-conventions.
4915

5016
repositories {
5117
mavenCentral()
@@ -58,16 +24,24 @@ dependencies {
5824
api("com.fasterxml.jackson.core:jackson-databind:2.10.1")
5925
api("com.mashape.unirest:unirest-java:1.4.9")
6026
testImplementation("junit:junit:4.12")
27+
// com.maxxton.convention forces useJUnitPlatform() on all Test tasks;
28+
// the vintage engine lets these existing JUnit 4 tests run on it.
29+
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.2")
6130
}
6231

6332
task javadocJar(type: Jar, dependsOn: javadoc) {
6433
archiveClassifier = 'javadoc'
6534
from 'build/docs/javadoc'
6635
}
6736

68-
task sourcesJar(type: Jar) {
69-
from sourceSets.main.allSource
70-
archiveClassifier = "sources"
37+
// Registers the sourcesJar task (withJavadocJar() just attaches the
38+
// existing javadocJar task above). Declared before the artifacts{} block
39+
// below so both tasks are guaranteed to exist by the time it references
40+
// them, rather than relying on the com.maxxton.convention plugin having
41+
// already created sourcesJar earlier via PublishingConfiguration.
42+
java {
43+
withJavadocJar()
44+
withSourcesJar()
7145
}
7246

7347
artifacts {
@@ -77,16 +51,6 @@ artifacts {
7751
archives sourcesJar
7852
}
7953

80-
signing {
81-
sign configurations.archives
82-
sign publishing.publications
83-
}
84-
85-
java {
86-
withJavadocJar()
87-
withSourcesJar()
88-
}
89-
9054
javadoc {
9155
if(JavaVersion.current().isJava9Compatible()) {
9256
options.addBooleanOption('html5', true)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is a Gradle generated file for dependency locking.
2+
# Manual edits can break the build and are not advised.
3+
# This file is expected to be part of source control.
4+
com.fasterxml.jackson.core:jackson-annotations:2.10.1=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
5+
com.fasterxml.jackson.core:jackson-core:2.10.1=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
6+
com.fasterxml.jackson.core:jackson-databind:2.10.1=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
7+
com.mashape.unirest:unirest-java:1.4.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
8+
commons-codec:commons-codec:1.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
9+
commons-logging:commons-logging:1.2=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
10+
junit:junit:4.12=integrationTestCompileClasspath,testCompileClasspath
11+
junit:junit:4.13.2=integrationTestRuntimeClasspath,testRuntimeClasspath
12+
org.apache.httpcomponents:httpasyncclient:4.1.1=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
13+
org.apache.httpcomponents:httpclient:4.5.2=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
14+
org.apache.httpcomponents:httpcore-nio:4.4.4=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
15+
org.apache.httpcomponents:httpcore:4.4.4=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
16+
org.apache.httpcomponents:httpmime:4.5.2=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
17+
org.hamcrest:hamcrest-core:1.3=integrationTestCompileClasspath,integrationTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
18+
org.json:json:20160212=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
19+
org.junit.platform:junit-platform-commons:1.10.2=integrationTestRuntimeClasspath,testRuntimeClasspath
20+
org.junit.platform:junit-platform-engine:1.10.2=integrationTestRuntimeClasspath,testRuntimeClasspath
21+
org.junit.vintage:junit-vintage-engine:5.10.2=integrationTestRuntimeClasspath,testRuntimeClasspath
22+
org.junit:junit-bom:5.10.2=integrationTestRuntimeClasspath,testRuntimeClasspath
23+
org.opentest4j:opentest4j:1.3.0=integrationTestRuntimeClasspath,testRuntimeClasspath
24+
empty=annotationProcessor,integrationTestAnnotationProcessor,testAnnotationProcessor
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
group=com.maxxton
2+
version=4.0.1
Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
rootProject.name = 'microdocs-core-java'
1+
pluginManagement {
2+
repositories {
3+
mavenLocal()
4+
maven {
5+
url = uri("artifactregistry://europe-maven.pkg.dev/dynamic-concept-192711/maxxton-maven-virtual")
6+
}
7+
gradlePluginPortal()
8+
}
9+
plugins {
10+
id("com.google.cloud.artifactregistry.gradle.plugin") version "2.2.5"
11+
}
12+
}
13+
14+
buildscript {
15+
repositories {
16+
gradlePluginPortal()
17+
}
18+
dependencies {
19+
classpath("com.google.cloud.artifactregistry.gradle-plugin:com.google.cloud.artifactregistry.gradle-plugin.gradle.plugin:2.2.5")
20+
}
21+
}
222

23+
apply plugin: com.google.cloud.artifactregistry.gradle.plugin.ArtifactRegistryGradlePlugin
24+
25+
rootProject.name = 'microdocs-core-java'

microdocs-core-java/src/main/java/com/maxxton/microdocs/core/domain/schema/SchemaPrimitive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @author Steven Hermans
55
*/
6-
public class SchemaPrimitive extends Schema {
6+
public final class SchemaPrimitive extends Schema {
77

88
public SchemaPrimitive() { }
99

microdocs-core-java/src/main/java/com/maxxton/microdocs/core/reflect/ReflectDescriptionTag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @author Steven Hermans
55
*/
6-
public class ReflectDescriptionTag {
6+
public final class ReflectDescriptionTag {
77

88
private String tagName;
99
private String keyword;

microdocs-core-java/src/main/java/com/maxxton/microdocs/crawler/spring/parser/SpecificationsParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public String getClassName() {
2424
}
2525

2626
@Override
27-
public List<Parameter> parse(ReflectParameter reflectParameter, ReflectClass controller, ReflectMethod method, SchemaCollector schemaCollector) {
27+
public List<Parameter> parse(ReflectParameter reflectParameter, ReflectClass<?> controller, ReflectMethod method, SchemaCollector schemaCollector) {
2828
List<Parameter> parameters = new ArrayList<>();
2929

3030
ParameterVariable filterParameter = new ParameterVariable();

0 commit comments

Comments
 (0)