From 87dd35e2e9ce17461e2cf4480a2fd7c0d62a1601 Mon Sep 17 00:00:00 2001 From: Jan Mosig Date: Fri, 12 Aug 2022 15:46:23 +0200 Subject: [PATCH 1/5] Updated project to latest things --- README.md | 2 +- pom.xml | 4 +- .../resources/archetype-resources/README.md | 6 ++ .../resources/archetype-resources/pom.xml | 85 ++++++------------- 4 files changed, 33 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 6c1a4c8..cb91793 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The latest release version always tries to include the latest versions of all us Projects created with this archetype will also contain reasonable default configuration for your favorit IDE. Have a look at the directory `ide_setup` for details. ## Build -Note: JDK >=17 is required for the build. +Note: JDK >=11 is required for the build. `mvn clean install` diff --git a/pom.xml b/pom.xml index 70abc27..339c73e 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ 11 UTF-8 UTF-8 - 3.2.0 + 3.2.1 1.5.3 ${maven.build.timestamp} yyyy-MM-dd HH:mm.ssZ @@ -90,7 +90,6 @@ maven-install-plugin - com.google.code.maven-replacer-plugin replacer @@ -114,7 +113,6 @@ - diff --git a/src/main/resources/archetype-resources/README.md b/src/main/resources/archetype-resources/README.md index d88af45..538ab22 100644 --- a/src/main/resources/archetype-resources/README.md +++ b/src/main/resources/archetype-resources/README.md @@ -1,2 +1,8 @@ # A Fluffy New Project It's so fluffy! + +## Build +`mvn clean install` + +## Run +Run `java -jar target/de.my.groupid.artifactid-1.0.0-shaded.jar` or `mvn exec:exec` diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index a002bb9..67c72c3 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -49,43 +49,41 @@ project.website - 17 + 11 11 UTF-8 UTF-8 - - 3.0.0-M5 - 3.0.0-M5 - 3.2.1 - 3.1.0 - 3.2.4 - 3.2.2 - 3.10.0 - 3.0.0 - 3.2.0 - 3.0.0-M1 ${maven.build.timestamp} yyyy-MM-dd HH:mm.ssZ ${*} + + 3.0.0-M7 + 3.0.0-M7 + 3.2.1 + 3.2.0 + 3.3.0 + 3.2.2 + 3.10.1 + 3.1.0 + 3.2.0 + 3.0.1 31.1-jre - 4.3.1 + 4.6.1 2.2 - - - 4.5.3.0 - 4.5.3 - 5.8.2 - 0.8.7 + 4.7.1.1 + 4.7.1 + 5.9.0 + 0.8.8 5.0.0 - 3.22.0 - 1.2.10 - 3.9 - 4.1.1 - 2.32.0 + 3.23.1 + 1.2.11 + 3.10.1 + 4.2.0 + 2.33.2 0.23.1 org.apache.maven.plugins maven-surefire-plugin @@ -449,8 +438,7 @@ JVM running the maven process which then calls this plugin. --> java - -jar - ${project.build.directory}/${project.build.finalName}.jar + -jar ${project.build.directory}/${project.build.finalName}-shaded.jar @@ -464,30 +452,6 @@ - - JDK16_or_earlier - - (,17) - - - - - com.github.spotbugs - spotbugs - 4.2.0 - - - - - - com.github.spotbugs - spotbugs-maven-plugin - 4.2.0 - - - - mvn33 @@ -560,6 +524,7 @@ META-INF/MANIFEST.MF + META-INF/DEPENDENCIES META-INF/*.SF From 15b0c02d07c7bedb1204eced1113611fdbb3d2b6 Mon Sep 17 00:00:00 2001 From: Jan Mosig Date: Fri, 21 Jan 2022 11:43:03 +0100 Subject: [PATCH 2/5] Special test branch for archetype-plugin bug --- pom.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 339c73e..4080f12 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ fluffyj.archetype - 1.13.0-SNAPSHOT + 1.13.1-DONOTUSE maven-archetype Fluffy J Archetype @@ -114,6 +114,13 @@ + + + + src/test/resources + true + + From fb9780d800fa71fc501ae3656416b1b4915b82f8 Mon Sep 17 00:00:00 2001 From: Jan Mosig Date: Wed, 20 Nov 2024 14:32:56 +0100 Subject: [PATCH 3/5] Bumped dependencies --- pom.xml | 2 +- .../fluffy-lifecycle-mapping-metadata.xml | 4 ++-- src/main/resources/archetype-resources/pom.xml | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index e4a6c7a..5c1cead 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.itemis org-parent - 5.8.7 + 5.8.8 fluffyj.archetype diff --git a/src/main/resources/archetype-resources/ide_setup/eclipse/fluffy-lifecycle-mapping-metadata.xml b/src/main/resources/archetype-resources/ide_setup/eclipse/fluffy-lifecycle-mapping-metadata.xml index 178a6cc..0e5739f 100644 --- a/src/main/resources/archetype-resources/ide_setup/eclipse/fluffy-lifecycle-mapping-metadata.xml +++ b/src/main/resources/archetype-resources/ide_setup/eclipse/fluffy-lifecycle-mapping-metadata.xml @@ -5,7 +5,7 @@ org.apache.maven.plugins maven-help-plugin - 3.5.0 + 3.5.1 active-profiles @@ -18,7 +18,7 @@ com.github.spotbugs spotbugs-maven-plugin - 4.8.6.3 + 4.8.6.6 check diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index 3cf72b3..f5675df 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -61,27 +61,27 @@ ${*} - 3.5.0 - 3.5.0 + 3.5.2 + 3.5.2 3.3.1 3.4.0 3.6.0 3.4.2 3.13.0 3.4.1 - 3.5.0 + 3.5.1 3.1.3 - 33.3.0-jre - 5.13.0 + 33.3.1-jre + 5.14.2 3.0 - 4.8.6.3 + 4.8.6.6 4.8.6 - 5.11.0 + 5.11.3 0.8.12 9.0.1 3.26.3 - 1.5.8 - 3.16.2 + 1.5.12 + 3.17.3 4.2.2 3.9.1 1.3.0 From edd81e808a10f8431d1d77d896a332bde5adfdc5 Mon Sep 17 00:00:00 2001 From: Jan Mosig Date: Fri, 13 Dec 2024 14:26:37 +0100 Subject: [PATCH 4/5] Bumped dependencies --- README.md | 34 +---- pom.xml | 27 ++-- .../resources/archetype-resources/pom.xml | 129 ++++++------------ 3 files changed, 55 insertions(+), 135 deletions(-) diff --git a/README.md b/README.md index cb91793..51a4869 100644 --- a/README.md +++ b/README.md @@ -5,47 +5,19 @@ Contains defaults for often used maven properties and common test dependencies, The latest release version always tries to include the latest versions of all used dependencies and plugins. -Projects created with this archetype will also contain reasonable default configuration for your favorit IDE. Have a look at the directory `ide_setup` for details. +Projects created with this archetype will also contain reasonable default configuration for your favorite IDE. Have a look at the directory `ide_setup` for details. ## Build -Note: JDK >=11 is required for the build. +Note: JDK >=21 is required for the build. `mvn clean install` -### Maven < 3.5.0 -When building with older Maven versions (looking at you, 3.3.9), make sure to activate the corresponding profile: - -`mvn clean install -Pmvn33` - -This is required, because Maven switched from Eclipse Aether to Maven Artifact Resolver since 3.5.0. - ## Usage Generate a new project with this command: `mvn archetype:generate -B -DarchetypeGroupId=com.itemis -DarchetypeArtifactId=fluffyj.archetype -DarchetypeVersion=1.13.0-SNAPSHOT -DgroupId=de.my.groupid -DartifactId=de.my.groupid.artifactid -Dversion=1.0.0-SNAPSHOT -Dpackage=de.my.groupid.artifactid` -Build the created project with `mvn clean install`. When building with Maven < 3.5.0, you need to activate the appropriate profile: `mvn clean install -Pmvn33`. - -### Note on usage with Java >=16 -When running Maven with Java >16 make sure to use the latest archetype plugin version (currently 3.2.0). You can force the version by calling Maven like this: - -`mvn org.apache.maven.plugins:maven-archetype-plugin:3.2.0:generate ...` +Build the created project with `mvn clean install`. -Background: The fluffy archetype is using a post generation script based on Groovy. Java 16 is the first Java version not permitting old Groovy versions to do any reflection without providing a proper module configuration. If you use an old archetype plugin version (e. g. 3.0.1), you are also going to use an old Groovy version. This will result in an error like this: - -` - Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module - ` - -Until Java 16 this used to be: -`[INFO] Executing META-INF/archetype-post-generate.groovy post-generation script -WARNING: An illegal reflective access operation has occurred -WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass$3$1 (file:/C:/Users/itsme/.m2/repository/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar) to method java.lang.Object.finalize() -WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass$3$1 -WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations -WARNING: All illegal access operations will be denied in a future release` - -In order to prevent this, an up to date Groovy version must be used, which is only the case with up to date versions of the archetype plugin. - ## Development The latest snapshot lives on the `develop` branch. The latest release lives on the `main` branch. A tag will be created for every release. diff --git a/pom.xml b/pom.xml index 4080f12..21ffba2 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ fluffyj.archetype - 1.13.1-DONOTUSE + 1.14.0-SNAPSHOT maven-archetype Fluffy J Archetype @@ -48,11 +48,12 @@ - 17 - 11 + 21 + 17 UTF-8 UTF-8 - 3.2.1 + 3.3.1 + 3.1.3 1.5.3 ${maven.build.timestamp} yyyy-MM-dd HH:mm.ssZ @@ -75,6 +76,10 @@ maven-clean-plugin + + maven-deploy-plugin + ${version.maven-deploy-plugin} + maven-archetype-plugin @@ -123,18 +128,4 @@ - - - - - mvn33 - - false - - - -Pmvn33 - - - diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index 67c72c3..eb4e1d7 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -49,8 +49,8 @@ project.website - 11 - 11 + 17 + 17 UTF-8 UTF-8 ${maven.build.timestamp} @@ -59,32 +59,32 @@ files. These will be expanded by the maven build as soon as the resources plugin processes all contents of the configured resources directories. --> ${*} - - 3.0.0-M7 - 3.0.0-M7 - 3.2.1 - 3.2.0 - 3.3.0 - 3.2.2 - 3.10.1 - 3.1.0 - 3.2.0 - 3.0.1 - 31.1-jre - 4.6.1 - 2.2 - 4.7.1.1 - 4.7.1 - 5.9.0 - 0.8.8 - 5.0.0 - 3.23.1 - 1.2.11 - 3.10.1 - 4.2.0 - 2.33.2 - 0.23.1 + 3.5.2 + 3.5.2 + 3.3.1 + 3.4.0 + 3.6.0 + 3.4.2 + 3.13.0 + 3.5.0 + 3.5.1 + 3.1.3 + 33.3.1-jre + 5.14.2 + 3.0 + 4.8.6.4 + 4.8.6 + 5.11.3 + 0.8.12 + 3.26.3 + 1.5.12 + 3.17.5 + 4.2.2 + 3.9.0 + 1.3.0 @@ -95,7 +95,6 @@ - com.google.guava guava @@ -108,79 +107,68 @@ spotbugs ${spotbugs.version} - ch.qos.logback logback-classic ${logback.version} - org.junit.jupiter junit-jupiter-api ${junit.version} test - org.junit.jupiter junit-jupiter-engine ${junit.version} test - com.tngtech.archunit archunit-junit5 ${arch.unit.version} test - org.mockito mockito-core ${mockito.version} test - org.mockito mockito-junit-jupiter ${mockito.version} test - org.hamcrest hamcrest ${hamcrest.version} test - org.assertj assertj-core ${assertj.version} test - nl.jqno.equalsverifier equalsverifier ${equalsverifier.version} test - org.awaitility awaitility ${awaitility.version} test - - com.github.tomakehurst - wiremock-jre8 + org.wiremock + wiremock ${wiremock.version} test @@ -249,8 +237,8 @@ test - com.github.tomakehurst - wiremock-jre8 + org.wiremock + wiremock test @@ -322,11 +310,6 @@ spotbugs-maven-plugin ${spotbugs.plugin.version} - - io.github.git-commit-id - git-commit-id-maven-plugin - ${git-commit-id-plugin.version} - org.apache.maven.plugins maven-surefire-plugin @@ -400,7 +383,8 @@ the solution is to use MAVEN_OPTS="\-\-add-modules .. mvn clean verify". --> true 1 - ${argLine} ${custom.jvm.options} @@ -413,7 +397,8 @@ maven-source-plugin - + com.github.spotbugs spotbugs-maven-plugin @@ -438,7 +423,9 @@ JVM running the maven process which then calls this plugin. --> java - -jar ${project.build.directory}/${project.build.finalName}-shaded.jar + + -jar + ${project.build.directory}/${project.build.finalName}-shaded.jar @@ -452,39 +439,6 @@ - - mvn33 - - false - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.2 - - - - - maven-install-plugin - - - org.apache.maven - maven-resolver-provider - 3.5.0 - - - - - - - create_uber_jar @@ -498,7 +452,8 @@ - + true + see: + https://stackoverflow.com/questions/51751981/why-does-maven-shade-plugin-remove-module-info-class --> *:* @@ -558,4 +514,5 @@ + From 8897f097dfb973c188dd513bc3e4506ba9e4eb1c Mon Sep 17 00:00:00 2001 From: Jan Mosig Date: Fri, 10 Jan 2025 15:29:47 +0100 Subject: [PATCH 5/5] Bug was fixed with new archetype plugin version --- pom.xml | 12 +++- .../META-INF/archetype-post-generate.groovy | 38 ------------ .../META-INF/maven/archetype-metadata.xml | 4 +- .../{gitignore => .gitignore} | 0 .../resources/archetype-resources/pom.xml | 59 +++++++++++-------- 5 files changed, 44 insertions(+), 69 deletions(-) delete mode 100644 src/main/resources/META-INF/archetype-post-generate.groovy rename src/main/resources/archetype-resources/{gitignore => .gitignore} (100%) diff --git a/pom.xml b/pom.xml index 21ffba2..8ab82a7 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,8 @@ maven-archetype Fluffy J Archetype - An improved variety of a Maven Java project archetype. Extra fluffy ❤ + An improved variety of a Maven Java project archetype. Extra + fluffy ❤ @@ -82,13 +83,17 @@ maven-archetype-plugin + + false + maven-resources-plugin UTF-8 UTF-8 - + false @@ -109,7 +114,8 @@ @ - ${project.build.testOutputDirectory}/projects/it-basic/goal.txt + + ${project.build.testOutputDirectory}/projects/it-basic/goal.txt fluffy.profiles diff --git a/src/main/resources/META-INF/archetype-post-generate.groovy b/src/main/resources/META-INF/archetype-post-generate.groovy deleted file mode 100644 index aa1fbbb..0000000 --- a/src/main/resources/META-INF/archetype-post-generate.groovy +++ /dev/null @@ -1,38 +0,0 @@ -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths - -/* -Adding .gitignore directly via maven resources plugin is currently broken. -See: https://issues.apache.org/jira/projects/ARCHETYPE/issues/ARCHETYPE-505 - -Thus, we include the file with a different filename and rename it manually with this post processing script. -See: https://maven.apache.org/archetype/maven-archetype-plugin/advanced-usage.html -*/ - -Path gitIgnorePath = Paths.get(request.outputDirectory, request.artifactId, "gitignore"); -Path targetPath = gitIgnorePath.getParent().resolve(".gitignore"); - -boolean isArchetypeBuild = gitIgnorePath.toString().contains("it-basic"); -boolean setupFailed = false; -errMsg = ""; - -if (Files.exists(gitIgnorePath)) { - System.out.println("Now setting up .gitignore file.."); - try { - Files.move(gitIgnorePath, targetPath); - } catch (Exception e) { - errMsg = "[WARNING] Could not setup .gitignore file. Reason: " + e.getClass().getSimpleName() + ": " + e.getMessage(); - setupFailed = true; - } -} else { - errMsg = "[WARNING] Could not find $gitIgnorePath! Your project will not have a proper .gitignore file :("; - setupFailed = true; -} - -if (setupFailed) { - System.err.println(errMsg); - if (isArchetypeBuild) { - throw new Exception("Stopping the build because the post processing script ran into a problem. See log for error details."); - } -} diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml index 8028108..fd252bb 100644 --- a/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -9,9 +9,7 @@ - - - gitignore + .gitignore .editorconfig README.md spotbugs-exclude.xml diff --git a/src/main/resources/archetype-resources/gitignore b/src/main/resources/archetype-resources/.gitignore similarity index 100% rename from src/main/resources/archetype-resources/gitignore rename to src/main/resources/archetype-resources/.gitignore diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index eb4e1d7..3ba002a 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -61,7 +61,8 @@ ${*} + ${java.version} + --> 3.5.2 3.5.2 3.3.1 @@ -72,22 +73,21 @@ 3.5.0 3.5.1 3.1.3 - 33.3.1-jre + 33.4.0-jre 5.14.2 3.0 4.8.6.4 4.8.6 - 5.11.3 + 5.11.4 0.8.12 - 3.26.3 - 1.5.12 - 3.17.5 + 3.27.1 + 1.5.16 + 3.18 4.2.2 3.9.0 1.3.0 - + -Xshare:off @@ -112,6 +112,11 @@ logback-classic ${logback.version} + + ch.qos.logback + logback-core + ${logback.version} + org.junit.jupiter junit-jupiter-api @@ -180,13 +185,16 @@ com.google.guava guava + + ch.qos.logback + logback-core + ch.qos.logback logback-classic - + com.github.spotbugs spotbugs @@ -342,6 +350,9 @@ ${maven-compiler-plugin.version} ${maven.compiler.release} + + -proc:full + @@ -383,9 +394,7 @@ the solution is to use MAVEN_OPTS="\-\-add-modules .. mvn clean verify". --> true 1 - + ${argLine} ${custom.jvm.options} @@ -397,8 +406,7 @@ maven-source-plugin - + com.github.spotbugs spotbugs-maven-plugin @@ -450,10 +458,8 @@ org.apache.maven.plugins maven-shade-plugin - - + + true - *:* **/module-info.class - + META-INF/MANIFEST.MF META-INF/DEPENDENCIES - + META-INF/*.SF META-INF/*.DSA META-INF/*.RSA @@ -494,6 +497,12 @@ ** + + ch.qos.logback:logback-classic + + ** + +