diff --git a/.github/workflows/test_linux_build_on_windows.yml b/.github/workflows/test_linux_build_on_windows.yml index 4a76370e..2298cf5d 100644 --- a/.github/workflows/test_linux_build_on_windows.yml +++ b/.github/workflows/test_linux_build_on_windows.yml @@ -41,7 +41,7 @@ jobs: run: go install github.com/google/go-licenses@v1.2.1 - name: Build project-keeper run: | - mvn clean package -DskipTests \ + mvn clean package -DskipTests -DtrimStackTrace=false \ --batch-mode \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - name: Strip version number @@ -97,4 +97,4 @@ jobs: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" - name: run project-keeper shell: pwsh - run: mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify --projects . \ No newline at end of file + run: mvn --batch-mode -DtrimStackTrace=false com.exasol:project-keeper-maven-plugin:verify --projects . \ No newline at end of file diff --git a/.github/workflows/test_on_windows.yml b/.github/workflows/test_on_windows.yml index 0ed9d3a3..6c68db9d 100644 --- a/.github/workflows/test_on_windows.yml +++ b/.github/workflows/test_on_windows.yml @@ -40,6 +40,6 @@ jobs: - name: Install Go tools run: go install github.com/google/go-licenses@v1.2.1 - name: Build and install - run: mvn --batch-mode clean install + run: mvn --batch-mode -DtrimStackTrace=false clean install - name: Run project-keeper itself - run: mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify --projects . \ No newline at end of file + run: mvn --batch-mode -DtrimStackTrace=false com.exasol:project-keeper-maven-plugin:verify --projects . \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..b9916c92 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": true, + "source.generate.finalModifiers": true + }, + "java.saveActions.organizeImports": true, + "java.sources.organizeImports.starThreshold": 3, + "java.sources.organizeImports.staticStarThreshold": 3, + "java.test.config": { + "vmArgs": [ + "-Djava.util.logging.config.file=src/test/resources/logging.properties" + ] + }, +} \ No newline at end of file diff --git a/dependencies.md b/dependencies.md index f678a77f..b7e7cee6 100644 --- a/dependencies.md +++ b/dependencies.md @@ -24,6 +24,7 @@ | [JUnit5 System Extensions][16] | [Eclipse Public License v2.0][7] | | [EqualsVerifier | release normal jar][17] | [Apache License, Version 2.0][18] | | [mockito-core][19] | [The MIT License][20] | +| [SLF4J JDK14 Binding][21] | [MIT License][22] | ### Runtime Dependencies @@ -35,27 +36,27 @@ | Dependency | License | | ------------------------------------------------------- | ---------------------------------------------- | -| [SonarQube Scanner for Maven][21] | [GNU LGPL 3][22] | -| [Apache Maven Compiler Plugin][23] | [Apache License, Version 2.0][18] | -| [Apache Maven Enforcer Plugin][24] | [Apache License, Version 2.0][18] | -| [Maven Flatten Plugin][25] | [Apache Software Licenese][26] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][27] | [ASL2][26] | -| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][18] | -| [Versions Maven Plugin][29] | [Apache License, Version 2.0][18] | -| [Apache Maven Deploy Plugin][30] | [Apache License, Version 2.0][18] | -| [Apache Maven GPG Plugin][31] | [Apache License, Version 2.0][18] | -| [Apache Maven Source Plugin][32] | [Apache License, Version 2.0][18] | -| [Apache Maven Javadoc Plugin][33] | [Apache License, Version 2.0][18] | -| [Nexus Staging Maven Plugin][34] | [Eclipse Public License][35] | -| [Lombok Maven Plugin][36] | [The MIT License][10] | -| [JaCoCo :: Maven Plugin][37] | [Eclipse Public License 2.0][38] | -| [error-code-crawler-maven-plugin][39] | [MIT License][40] | -| [Reproducible Build Maven Plugin][41] | [Apache 2.0][26] | -| [Maven Clean Plugin][42] | [The Apache Software License, Version 2.0][26] | -| [Maven Resources Plugin][43] | [The Apache Software License, Version 2.0][26] | -| [Maven JAR Plugin][44] | [The Apache Software License, Version 2.0][26] | -| [Maven Install Plugin][45] | [The Apache Software License, Version 2.0][26] | -| [Maven Site Plugin 3][46] | [The Apache Software License, Version 2.0][26] | +| [SonarQube Scanner for Maven][23] | [GNU LGPL 3][24] | +| [Apache Maven Compiler Plugin][25] | [Apache License, Version 2.0][18] | +| [Apache Maven Enforcer Plugin][26] | [Apache License, Version 2.0][18] | +| [Maven Flatten Plugin][27] | [Apache Software Licenese][28] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][29] | [ASL2][28] | +| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][18] | +| [Versions Maven Plugin][31] | [Apache License, Version 2.0][18] | +| [Apache Maven Deploy Plugin][32] | [Apache License, Version 2.0][18] | +| [Apache Maven GPG Plugin][33] | [Apache License, Version 2.0][18] | +| [Apache Maven Source Plugin][34] | [Apache License, Version 2.0][18] | +| [Apache Maven Javadoc Plugin][35] | [Apache License, Version 2.0][18] | +| [Nexus Staging Maven Plugin][36] | [Eclipse Public License][37] | +| [Lombok Maven Plugin][38] | [The MIT License][10] | +| [JaCoCo :: Maven Plugin][39] | [Eclipse Public License 2.0][40] | +| [error-code-crawler-maven-plugin][41] | [MIT License][42] | +| [Reproducible Build Maven Plugin][43] | [Apache 2.0][28] | +| [Maven Clean Plugin][44] | [The Apache Software License, Version 2.0][28] | +| [Maven Resources Plugin][45] | [The Apache Software License, Version 2.0][28] | +| [Maven JAR Plugin][46] | [The Apache Software License, Version 2.0][28] | +| [Maven Install Plugin][47] | [The Apache Software License, Version 2.0][28] | +| [Maven Site Plugin 3][48] | [The Apache Software License, Version 2.0][28] | ## Project Keeper Core @@ -63,63 +64,64 @@ | Dependency | License | | ----------------------------------------- | ---------------------------------------------- | -| [Project-Keeper shared model classes][47] | [The MIT License][48] | -| [jaxb-api][49] | [CDDL 1.1][50]; [GPL2 w/ CPE][50] | -| [JAXB Runtime][51] | [Eclipse Distribution License - v 1.0][8] | -| [org.xmlunit:xmlunit-core][52] | [The Apache Software License, Version 2.0][26] | +| [Project-Keeper shared model classes][49] | [The MIT License][50] | +| [jaxb-api][51] | [CDDL 1.1][52]; [GPL2 w/ CPE][52] | +| [JAXB Runtime][53] | [Eclipse Distribution License - v 1.0][8] | +| [org.xmlunit:xmlunit-core][54] | [The Apache Software License, Version 2.0][28] | | [error-reporting-java][9] | [MIT][10] | -| [Markdown Generator][53] | [The Apache Software License, Version 2.0][26] | -| [semver4j][54] | [The MIT License][55] | +| [Markdown Generator][55] | [The Apache Software License, Version 2.0][28] | +| [semver4j][56] | [The MIT License][22] | | [Project Lombok][0] | [The MIT License][1] | -| [SnakeYAML][56] | [Apache License, Version 2.0][26] | -| [Maven Model][57] | [Apache License, Version 2.0][18] | +| [SnakeYAML][57] | [Apache License, Version 2.0][28] | +| [Maven Model][58] | [Apache License, Version 2.0][18] | ### Test Dependencies | Dependency | License | | ----------------------------------------- | ---------------------------------------------- | -| [Project Keeper shared test setup][47] | [The MIT License][48] | -| [Maven Project Version Getter][58] | [MIT][10] | +| [Project Keeper shared test setup][49] | [The MIT License][50] | +| [Maven Project Version Getter][59] | [MIT][10] | | [JUnit Jupiter Engine][12] | [Eclipse Public License v2.0][13] | | [JUnit Jupiter Params][12] | [Eclipse Public License v2.0][13] | | [Hamcrest][14] | [BSD License 3][15] | -| [org.xmlunit:xmlunit-matchers][52] | [The Apache Software License, Version 2.0][26] | +| [org.xmlunit:xmlunit-matchers][54] | [The Apache Software License, Version 2.0][28] | | [mockito-junit-jupiter][19] | [The MIT License][20] | -| [Maven Plugin Integration Testing][59] | [MIT License][60] | +| [Maven Plugin Integration Testing][60] | [MIT License][61] | | [EqualsVerifier | release normal jar][17] | [Apache License, Version 2.0][18] | +| [SLF4J JDK14 Binding][21] | [MIT License][22] | ### Runtime Dependencies | Dependency | License | | ----------------------------------------- | --------------------- | -| [Project keeper Java project crawler][47] | [The MIT License][48] | +| [Project keeper Java project crawler][49] | [The MIT License][50] | ### Plugin Dependencies | Dependency | License | | ------------------------------------------------------- | ---------------------------------------------- | -| [SonarQube Scanner for Maven][21] | [GNU LGPL 3][22] | -| [Apache Maven Compiler Plugin][23] | [Apache License, Version 2.0][18] | -| [Apache Maven Enforcer Plugin][24] | [Apache License, Version 2.0][18] | -| [Maven Flatten Plugin][25] | [Apache Software Licenese][26] | -| [Apache Maven JAR Plugin][61] | [Apache License, Version 2.0][18] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][27] | [ASL2][26] | -| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][18] | -| [Versions Maven Plugin][29] | [Apache License, Version 2.0][18] | -| [Apache Maven Deploy Plugin][30] | [Apache License, Version 2.0][18] | -| [Apache Maven GPG Plugin][31] | [Apache License, Version 2.0][18] | -| [Apache Maven Source Plugin][32] | [Apache License, Version 2.0][18] | -| [Apache Maven Javadoc Plugin][33] | [Apache License, Version 2.0][18] | -| [Nexus Staging Maven Plugin][34] | [Eclipse Public License][35] | -| [Lombok Maven Plugin][36] | [The MIT License][10] | -| [Maven Failsafe Plugin][62] | [Apache License, Version 2.0][18] | -| [JaCoCo :: Maven Plugin][37] | [Eclipse Public License 2.0][38] | -| [error-code-crawler-maven-plugin][39] | [MIT License][40] | -| [Reproducible Build Maven Plugin][41] | [Apache 2.0][26] | -| [Maven Clean Plugin][42] | [The Apache Software License, Version 2.0][26] | -| [Maven Resources Plugin][43] | [The Apache Software License, Version 2.0][26] | -| [Maven Install Plugin][45] | [The Apache Software License, Version 2.0][26] | -| [Maven Site Plugin 3][46] | [The Apache Software License, Version 2.0][26] | +| [SonarQube Scanner for Maven][23] | [GNU LGPL 3][24] | +| [Apache Maven Compiler Plugin][25] | [Apache License, Version 2.0][18] | +| [Apache Maven Enforcer Plugin][26] | [Apache License, Version 2.0][18] | +| [Maven Flatten Plugin][27] | [Apache Software Licenese][28] | +| [Apache Maven JAR Plugin][62] | [Apache License, Version 2.0][18] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][29] | [ASL2][28] | +| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][18] | +| [Versions Maven Plugin][31] | [Apache License, Version 2.0][18] | +| [Apache Maven Deploy Plugin][32] | [Apache License, Version 2.0][18] | +| [Apache Maven GPG Plugin][33] | [Apache License, Version 2.0][18] | +| [Apache Maven Source Plugin][34] | [Apache License, Version 2.0][18] | +| [Apache Maven Javadoc Plugin][35] | [Apache License, Version 2.0][18] | +| [Nexus Staging Maven Plugin][36] | [Eclipse Public License][37] | +| [Lombok Maven Plugin][38] | [The MIT License][10] | +| [Maven Failsafe Plugin][63] | [Apache License, Version 2.0][18] | +| [JaCoCo :: Maven Plugin][39] | [Eclipse Public License 2.0][40] | +| [error-code-crawler-maven-plugin][41] | [MIT License][42] | +| [Reproducible Build Maven Plugin][43] | [Apache 2.0][28] | +| [Maven Clean Plugin][44] | [The Apache Software License, Version 2.0][28] | +| [Maven Resources Plugin][45] | [The Apache Software License, Version 2.0][28] | +| [Maven Install Plugin][47] | [The Apache Software License, Version 2.0][28] | +| [Maven Site Plugin 3][48] | [The Apache Software License, Version 2.0][28] | ## Project Keeper Command Line Interface @@ -127,53 +129,53 @@ | Dependency | License | | ------------------------- | --------------------------------- | -| [Project keeper core][47] | [The MIT License][48] | +| [Project keeper core][49] | [The MIT License][50] | | [error-reporting-java][9] | [MIT][10] | -| [Maven Model][57] | [Apache License, Version 2.0][18] | +| [Maven Model][58] | [Apache License, Version 2.0][18] | ### Test Dependencies | Dependency | License | | -------------------------------------- | --------------------------------- | -| [Project Keeper shared test setup][47] | [The MIT License][48] | +| [Project Keeper shared test setup][49] | [The MIT License][50] | | [JUnit Jupiter Engine][12] | [Eclipse Public License v2.0][13] | | [JUnit Jupiter Params][12] | [Eclipse Public License v2.0][13] | | [Hamcrest][14] | [BSD License 3][15] | -| [Maven Project Version Getter][58] | [MIT][10] | +| [Maven Project Version Getter][59] | [MIT][10] | ### Runtime Dependencies | Dependency | License | | ------------------------- | ----------------- | -| [SLF4J JDK14 Binding][63] | [MIT License][55] | +| [SLF4J JDK14 Binding][21] | [MIT License][22] | ### Plugin Dependencies | Dependency | License | | ------------------------------------------------------- | ---------------------------------------------- | -| [SonarQube Scanner for Maven][21] | [GNU LGPL 3][22] | -| [Apache Maven Compiler Plugin][23] | [Apache License, Version 2.0][18] | -| [Apache Maven Enforcer Plugin][24] | [Apache License, Version 2.0][18] | -| [Maven Flatten Plugin][25] | [Apache Software Licenese][26] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][27] | [ASL2][26] | -| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][18] | -| [Versions Maven Plugin][29] | [Apache License, Version 2.0][18] | +| [SonarQube Scanner for Maven][23] | [GNU LGPL 3][24] | +| [Apache Maven Compiler Plugin][25] | [Apache License, Version 2.0][18] | +| [Apache Maven Enforcer Plugin][26] | [Apache License, Version 2.0][18] | +| [Maven Flatten Plugin][27] | [Apache Software Licenese][28] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][29] | [ASL2][28] | +| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][18] | +| [Versions Maven Plugin][31] | [Apache License, Version 2.0][18] | | [Apache Maven Assembly Plugin][64] | [Apache License, Version 2.0][18] | -| [Apache Maven JAR Plugin][61] | [Apache License, Version 2.0][18] | +| [Apache Maven JAR Plugin][62] | [Apache License, Version 2.0][18] | | [Artifact reference checker and unifier][65] | [MIT][10] | -| [Apache Maven Deploy Plugin][30] | [Apache License, Version 2.0][18] | -| [Apache Maven GPG Plugin][31] | [Apache License, Version 2.0][18] | -| [Apache Maven Source Plugin][32] | [Apache License, Version 2.0][18] | -| [Apache Maven Javadoc Plugin][33] | [Apache License, Version 2.0][18] | -| [Nexus Staging Maven Plugin][34] | [Eclipse Public License][35] | -| [Maven Failsafe Plugin][62] | [Apache License, Version 2.0][18] | -| [JaCoCo :: Maven Plugin][37] | [Eclipse Public License 2.0][38] | -| [error-code-crawler-maven-plugin][39] | [MIT License][40] | -| [Reproducible Build Maven Plugin][41] | [Apache 2.0][26] | -| [Maven Clean Plugin][42] | [The Apache Software License, Version 2.0][26] | -| [Maven Resources Plugin][43] | [The Apache Software License, Version 2.0][26] | -| [Maven Install Plugin][45] | [The Apache Software License, Version 2.0][26] | -| [Maven Site Plugin 3][46] | [The Apache Software License, Version 2.0][26] | +| [Apache Maven Deploy Plugin][32] | [Apache License, Version 2.0][18] | +| [Apache Maven GPG Plugin][33] | [Apache License, Version 2.0][18] | +| [Apache Maven Source Plugin][34] | [Apache License, Version 2.0][18] | +| [Apache Maven Javadoc Plugin][35] | [Apache License, Version 2.0][18] | +| [Nexus Staging Maven Plugin][36] | [Eclipse Public License][37] | +| [Maven Failsafe Plugin][63] | [Apache License, Version 2.0][18] | +| [JaCoCo :: Maven Plugin][39] | [Eclipse Public License 2.0][40] | +| [error-code-crawler-maven-plugin][41] | [MIT License][42] | +| [Reproducible Build Maven Plugin][43] | [Apache 2.0][28] | +| [Maven Clean Plugin][44] | [The Apache Software License, Version 2.0][28] | +| [Maven Resources Plugin][45] | [The Apache Software License, Version 2.0][28] | +| [Maven Install Plugin][47] | [The Apache Software License, Version 2.0][28] | +| [Maven Site Plugin 3][48] | [The Apache Software License, Version 2.0][28] | ## Project Keeper Maven Plugin @@ -181,10 +183,10 @@ | Dependency | License | | ----------------------------------------- | ---------------------------------------------- | -| [Project keeper core][47] | [The MIT License][48] | +| [Project keeper core][49] | [The MIT License][50] | | [Maven Plugin Tools Java Annotations][66] | [Apache License, Version 2.0][18] | | [Maven Plugin API][67] | [Apache License, Version 2.0][18] | -| [Maven Project Builder][68] | [The Apache Software License, Version 2.0][26] | +| [Maven Project Builder][68] | [The Apache Software License, Version 2.0][28] | | [Maven Core][69] | [Apache License, Version 2.0][18] | | [error-reporting-java][9] | [MIT][10] | | [Project Lombok][0] | [The MIT License][1] | @@ -193,44 +195,45 @@ | Dependency | License | | -------------------------------------- | ---------------------------------------------- | -| [Maven Project Version Getter][58] | [MIT][10] | +| [Maven Project Version Getter][59] | [MIT][10] | | [JUnit Jupiter Engine][12] | [Eclipse Public License v2.0][13] | | [JUnit Jupiter Params][12] | [Eclipse Public License v2.0][13] | | [Hamcrest][14] | [BSD License 3][15] | -| [org.xmlunit:xmlunit-matchers][52] | [The Apache Software License, Version 2.0][26] | +| [org.xmlunit:xmlunit-matchers][54] | [The Apache Software License, Version 2.0][28] | | [mockito-core][19] | [The MIT License][20] | -| [JaCoCo :: Core][70] | [Eclipse Public License 2.0][38] | -| [Maven Plugin Integration Testing][59] | [MIT License][60] | -| [JaCoCo :: Agent][70] | [Eclipse Public License 2.0][38] | +| [JaCoCo :: Core][70] | [Eclipse Public License 2.0][40] | +| [Maven Plugin Integration Testing][60] | [MIT License][61] | +| [SLF4J JDK14 Binding][21] | [MIT License][22] | +| [JaCoCo :: Agent][70] | [Eclipse Public License 2.0][40] | ### Plugin Dependencies | Dependency | License | | ------------------------------------------------------- | ---------------------------------------------- | -| [SonarQube Scanner for Maven][21] | [GNU LGPL 3][22] | -| [Apache Maven Compiler Plugin][23] | [Apache License, Version 2.0][18] | -| [Apache Maven Enforcer Plugin][24] | [Apache License, Version 2.0][18] | -| [Maven Flatten Plugin][25] | [Apache Software Licenese][26] | +| [SonarQube Scanner for Maven][23] | [GNU LGPL 3][24] | +| [Apache Maven Compiler Plugin][25] | [Apache License, Version 2.0][18] | +| [Apache Maven Enforcer Plugin][26] | [Apache License, Version 2.0][18] | +| [Maven Flatten Plugin][27] | [Apache Software Licenese][28] | | [Maven Plugin Plugin][71] | [Apache License, Version 2.0][18] | -| [Apache Maven JAR Plugin][61] | [Apache License, Version 2.0][18] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][27] | [ASL2][26] | -| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][18] | -| [Versions Maven Plugin][29] | [Apache License, Version 2.0][18] | -| [Apache Maven Deploy Plugin][30] | [Apache License, Version 2.0][18] | -| [Apache Maven GPG Plugin][31] | [Apache License, Version 2.0][18] | -| [Apache Maven Source Plugin][32] | [Apache License, Version 2.0][18] | -| [Apache Maven Javadoc Plugin][33] | [Apache License, Version 2.0][18] | -| [Nexus Staging Maven Plugin][34] | [Eclipse Public License][35] | +| [Apache Maven JAR Plugin][62] | [Apache License, Version 2.0][18] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][29] | [ASL2][28] | +| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][18] | +| [Versions Maven Plugin][31] | [Apache License, Version 2.0][18] | +| [Apache Maven Deploy Plugin][32] | [Apache License, Version 2.0][18] | +| [Apache Maven GPG Plugin][33] | [Apache License, Version 2.0][18] | +| [Apache Maven Source Plugin][34] | [Apache License, Version 2.0][18] | +| [Apache Maven Javadoc Plugin][35] | [Apache License, Version 2.0][18] | +| [Nexus Staging Maven Plugin][36] | [Eclipse Public License][37] | | [Apache Maven Dependency Plugin][72] | [Apache License, Version 2.0][18] | -| [Lombok Maven Plugin][36] | [The MIT License][10] | -| [Maven Failsafe Plugin][62] | [Apache License, Version 2.0][18] | -| [JaCoCo :: Maven Plugin][37] | [Eclipse Public License 2.0][38] | -| [error-code-crawler-maven-plugin][39] | [MIT License][40] | -| [Reproducible Build Maven Plugin][41] | [Apache 2.0][26] | -| [Maven Clean Plugin][42] | [The Apache Software License, Version 2.0][26] | -| [Maven Resources Plugin][43] | [The Apache Software License, Version 2.0][26] | -| [Maven Install Plugin][45] | [The Apache Software License, Version 2.0][26] | -| [Maven Site Plugin 3][46] | [The Apache Software License, Version 2.0][26] | +| [Lombok Maven Plugin][38] | [The MIT License][10] | +| [Maven Failsafe Plugin][63] | [Apache License, Version 2.0][18] | +| [JaCoCo :: Maven Plugin][39] | [Eclipse Public License 2.0][40] | +| [error-code-crawler-maven-plugin][41] | [MIT License][42] | +| [Reproducible Build Maven Plugin][43] | [Apache 2.0][28] | +| [Maven Clean Plugin][44] | [The Apache Software License, Version 2.0][28] | +| [Maven Resources Plugin][45] | [The Apache Software License, Version 2.0][28] | +| [Maven Install Plugin][47] | [The Apache Software License, Version 2.0][28] | +| [Maven Site Plugin 3][48] | [The Apache Software License, Version 2.0][28] | ## Project Keeper Java Project Crawler @@ -238,13 +241,13 @@ | Dependency | License | | ----------------------------------------- | ---------------------------------------------- | -| [Project-Keeper shared model classes][47] | [The MIT License][48] | +| [Project-Keeper shared model classes][49] | [The MIT License][50] | | [Maven Plugin Tools Java Annotations][66] | [Apache License, Version 2.0][18] | | [Maven Plugin API][67] | [Apache License, Version 2.0][18] | -| [Maven Project Builder][68] | [The Apache Software License, Version 2.0][26] | +| [Maven Project Builder][68] | [The Apache Software License, Version 2.0][28] | | [error-reporting-java][9] | [MIT][10] | | [JGit - Core][11] | Eclipse Distribution License (New BSD License) | -| [semver4j][54] | [The MIT License][55] | +| [semver4j][56] | [The MIT License][22] | | [Maven Core][69] | [Apache License, Version 2.0][18] | | [Apache Commons IO][73] | [Apache License, Version 2.0][18] | @@ -252,44 +255,44 @@ | Dependency | License | | -------------------------------------- | ---------------------------------------------- | -| [Maven Project Version Getter][58] | [MIT][10] | +| [Maven Project Version Getter][59] | [MIT][10] | | [JUnit Jupiter Engine][12] | [Eclipse Public License v2.0][13] | | [JUnit Jupiter Params][12] | [Eclipse Public License v2.0][13] | | [Hamcrest][14] | [BSD License 3][15] | -| [org.xmlunit:xmlunit-matchers][52] | [The Apache Software License, Version 2.0][26] | -| [SLF4J JDK14 Binding][63] | [MIT License][55] | +| [org.xmlunit:xmlunit-matchers][54] | [The Apache Software License, Version 2.0][28] | +| [SLF4J JDK14 Binding][21] | [MIT License][22] | | [mockito-core][19] | [The MIT License][20] | -| [JaCoCo :: Core][70] | [Eclipse Public License 2.0][38] | -| [Maven Plugin Integration Testing][59] | [MIT License][60] | -| [JaCoCo :: Agent][70] | [Eclipse Public License 2.0][38] | +| [JaCoCo :: Core][70] | [Eclipse Public License 2.0][40] | +| [Maven Plugin Integration Testing][60] | [MIT License][61] | +| [JaCoCo :: Agent][70] | [Eclipse Public License 2.0][40] | ### Plugin Dependencies | Dependency | License | | ------------------------------------------------------- | ---------------------------------------------- | -| [SonarQube Scanner for Maven][21] | [GNU LGPL 3][22] | -| [Apache Maven Compiler Plugin][23] | [Apache License, Version 2.0][18] | -| [Apache Maven Enforcer Plugin][24] | [Apache License, Version 2.0][18] | -| [Maven Flatten Plugin][25] | [Apache Software Licenese][26] | +| [SonarQube Scanner for Maven][23] | [GNU LGPL 3][24] | +| [Apache Maven Compiler Plugin][25] | [Apache License, Version 2.0][18] | +| [Apache Maven Enforcer Plugin][26] | [Apache License, Version 2.0][18] | +| [Maven Flatten Plugin][27] | [Apache Software Licenese][28] | | [Maven Plugin Plugin][71] | [Apache License, Version 2.0][18] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][27] | [ASL2][26] | -| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][18] | -| [Versions Maven Plugin][29] | [Apache License, Version 2.0][18] | -| [Apache Maven Deploy Plugin][30] | [Apache License, Version 2.0][18] | -| [Apache Maven GPG Plugin][31] | [Apache License, Version 2.0][18] | -| [Apache Maven Source Plugin][32] | [Apache License, Version 2.0][18] | -| [Apache Maven Javadoc Plugin][33] | [Apache License, Version 2.0][18] | -| [Nexus Staging Maven Plugin][34] | [Eclipse Public License][35] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][29] | [ASL2][28] | +| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][18] | +| [Versions Maven Plugin][31] | [Apache License, Version 2.0][18] | +| [Apache Maven Deploy Plugin][32] | [Apache License, Version 2.0][18] | +| [Apache Maven GPG Plugin][33] | [Apache License, Version 2.0][18] | +| [Apache Maven Source Plugin][34] | [Apache License, Version 2.0][18] | +| [Apache Maven Javadoc Plugin][35] | [Apache License, Version 2.0][18] | +| [Nexus Staging Maven Plugin][36] | [Eclipse Public License][37] | | [Apache Maven Dependency Plugin][72] | [Apache License, Version 2.0][18] | -| [Maven Failsafe Plugin][62] | [Apache License, Version 2.0][18] | -| [JaCoCo :: Maven Plugin][37] | [Eclipse Public License 2.0][38] | -| [error-code-crawler-maven-plugin][39] | [MIT License][40] | -| [Reproducible Build Maven Plugin][41] | [Apache 2.0][26] | -| [Maven Clean Plugin][42] | [The Apache Software License, Version 2.0][26] | -| [Maven Resources Plugin][43] | [The Apache Software License, Version 2.0][26] | -| [Maven JAR Plugin][44] | [The Apache Software License, Version 2.0][26] | -| [Maven Install Plugin][45] | [The Apache Software License, Version 2.0][26] | -| [Maven Site Plugin 3][46] | [The Apache Software License, Version 2.0][26] | +| [Maven Failsafe Plugin][63] | [Apache License, Version 2.0][18] | +| [JaCoCo :: Maven Plugin][39] | [Eclipse Public License 2.0][40] | +| [error-code-crawler-maven-plugin][41] | [MIT License][42] | +| [Reproducible Build Maven Plugin][43] | [Apache 2.0][28] | +| [Maven Clean Plugin][44] | [The Apache Software License, Version 2.0][28] | +| [Maven Resources Plugin][45] | [The Apache Software License, Version 2.0][28] | +| [Maven JAR Plugin][46] | [The Apache Software License, Version 2.0][28] | +| [Maven Install Plugin][47] | [The Apache Software License, Version 2.0][28] | +| [Maven Site Plugin 3][48] | [The Apache Software License, Version 2.0][28] | ## Project Keeper Shared Test Setup @@ -297,33 +300,33 @@ | Dependency | License | | ----------------------------------------- | --------------------------------- | -| [Project-Keeper shared model classes][47] | [The MIT License][48] | -| [SnakeYAML][56] | [Apache License, Version 2.0][26] | +| [Project-Keeper shared model classes][49] | [The MIT License][50] | +| [SnakeYAML][57] | [Apache License, Version 2.0][28] | | [Hamcrest][14] | [BSD License 3][15] | -| [Maven Model][57] | [Apache License, Version 2.0][18] | +| [Maven Model][58] | [Apache License, Version 2.0][18] | | [Project Lombok][0] | [The MIT License][1] | ### Plugin Dependencies | Dependency | License | | ------------------------------------------------------- | ---------------------------------------------- | -| [SonarQube Scanner for Maven][21] | [GNU LGPL 3][22] | -| [Apache Maven Compiler Plugin][23] | [Apache License, Version 2.0][18] | -| [Apache Maven Enforcer Plugin][24] | [Apache License, Version 2.0][18] | -| [Maven Flatten Plugin][25] | [Apache Software Licenese][26] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][27] | [ASL2][26] | -| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][18] | -| [Versions Maven Plugin][29] | [Apache License, Version 2.0][18] | -| [Lombok Maven Plugin][36] | [The MIT License][10] | -| [JaCoCo :: Maven Plugin][37] | [Eclipse Public License 2.0][38] | -| [error-code-crawler-maven-plugin][39] | [MIT License][40] | -| [Reproducible Build Maven Plugin][41] | [Apache 2.0][26] | -| [Maven Clean Plugin][42] | [The Apache Software License, Version 2.0][26] | -| [Maven Resources Plugin][43] | [The Apache Software License, Version 2.0][26] | -| [Maven JAR Plugin][44] | [The Apache Software License, Version 2.0][26] | -| [Maven Install Plugin][45] | [The Apache Software License, Version 2.0][26] | -| [Maven Deploy Plugin][74] | [The Apache Software License, Version 2.0][26] | -| [Maven Site Plugin 3][46] | [The Apache Software License, Version 2.0][26] | +| [SonarQube Scanner for Maven][23] | [GNU LGPL 3][24] | +| [Apache Maven Compiler Plugin][25] | [Apache License, Version 2.0][18] | +| [Apache Maven Enforcer Plugin][26] | [Apache License, Version 2.0][18] | +| [Maven Flatten Plugin][27] | [Apache Software Licenese][28] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][29] | [ASL2][28] | +| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][18] | +| [Versions Maven Plugin][31] | [Apache License, Version 2.0][18] | +| [Lombok Maven Plugin][38] | [The MIT License][10] | +| [JaCoCo :: Maven Plugin][39] | [Eclipse Public License 2.0][40] | +| [error-code-crawler-maven-plugin][41] | [MIT License][42] | +| [Reproducible Build Maven Plugin][43] | [Apache 2.0][28] | +| [Maven Clean Plugin][44] | [The Apache Software License, Version 2.0][28] | +| [Maven Resources Plugin][45] | [The Apache Software License, Version 2.0][28] | +| [Maven JAR Plugin][46] | [The Apache Software License, Version 2.0][28] | +| [Maven Install Plugin][47] | [The Apache Software License, Version 2.0][28] | +| [Maven Deploy Plugin][74] | [The Apache Software License, Version 2.0][28] | +| [Maven Site Plugin 3][48] | [The Apache Software License, Version 2.0][28] | [0]: https://projectlombok.org [1]: https://projectlombok.org/LICENSE @@ -346,49 +349,49 @@ [18]: https://www.apache.org/licenses/LICENSE-2.0.txt [19]: https://github.com/mockito/mockito [20]: https://github.com/mockito/mockito/blob/main/LICENSE -[21]: http://sonarsource.github.io/sonar-scanner-maven/ -[22]: http://www.gnu.org/licenses/lgpl.txt -[23]: https://maven.apache.org/plugins/maven-compiler-plugin/ -[24]: https://maven.apache.org/enforcer/maven-enforcer-plugin/ -[25]: https://www.mojohaus.org/flatten-maven-plugin/ -[26]: http://www.apache.org/licenses/LICENSE-2.0.txt -[27]: https://sonatype.github.io/ossindex-maven/maven-plugin/ -[28]: https://maven.apache.org/surefire/maven-surefire-plugin/ -[29]: http://www.mojohaus.org/versions-maven-plugin/ -[30]: https://maven.apache.org/plugins/maven-deploy-plugin/ -[31]: https://maven.apache.org/plugins/maven-gpg-plugin/ -[32]: https://maven.apache.org/plugins/maven-source-plugin/ -[33]: https://maven.apache.org/plugins/maven-javadoc-plugin/ -[34]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ -[35]: http://www.eclipse.org/legal/epl-v10.html -[36]: https://anthonywhitford.com/lombok.maven/lombok-maven-plugin/ -[37]: https://www.jacoco.org/jacoco/trunk/doc/maven.html -[38]: https://www.eclipse.org/legal/epl-2.0/ -[39]: https://github.com/exasol/error-code-crawler-maven-plugin/ -[40]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE -[41]: http://zlika.github.io/reproducible-build-maven-plugin -[42]: http://maven.apache.org/plugins/maven-clean-plugin/ -[43]: http://maven.apache.org/plugins/maven-resources-plugin/ -[44]: http://maven.apache.org/plugins/maven-jar-plugin/ -[45]: http://maven.apache.org/plugins/maven-install-plugin/ -[46]: http://maven.apache.org/plugins/maven-site-plugin/ -[47]: https://github.com/exasol/project-keeper/ -[48]: https://github.com/exasol/project-keeper/blob/main/LICENSE -[49]: https://github.com/eclipse-ee4j/jaxb-api -[50]: https://oss.oracle.com/licenses/CDDL+GPL-1.1 -[51]: https://eclipse-ee4j.github.io/jaxb-ri/ -[52]: https://www.xmlunit.org/ -[53]: https://github.com/Steppschuh/Java-Markdown-Generator -[54]: https://github.com/vdurmont/semver4j -[55]: http://www.opensource.org/licenses/mit-license.php -[56]: https://bitbucket.org/snakeyaml/snakeyaml -[57]: https://maven.apache.org/ref/3.8.6/maven-model/ -[58]: https://github.com/exasol/maven-project-version-getter -[59]: https://github.com/exasol/maven-plugin-integration-testing/ -[60]: https://github.com/exasol/maven-plugin-integration-testing/blob/main/LICENSE -[61]: https://maven.apache.org/plugins/maven-jar-plugin/ -[62]: https://maven.apache.org/surefire/maven-failsafe-plugin/ -[63]: http://www.slf4j.org +[21]: http://www.slf4j.org +[22]: http://www.opensource.org/licenses/mit-license.php +[23]: http://sonarsource.github.io/sonar-scanner-maven/ +[24]: http://www.gnu.org/licenses/lgpl.txt +[25]: https://maven.apache.org/plugins/maven-compiler-plugin/ +[26]: https://maven.apache.org/enforcer/maven-enforcer-plugin/ +[27]: https://www.mojohaus.org/flatten-maven-plugin/ +[28]: http://www.apache.org/licenses/LICENSE-2.0.txt +[29]: https://sonatype.github.io/ossindex-maven/maven-plugin/ +[30]: https://maven.apache.org/surefire/maven-surefire-plugin/ +[31]: http://www.mojohaus.org/versions-maven-plugin/ +[32]: https://maven.apache.org/plugins/maven-deploy-plugin/ +[33]: https://maven.apache.org/plugins/maven-gpg-plugin/ +[34]: https://maven.apache.org/plugins/maven-source-plugin/ +[35]: https://maven.apache.org/plugins/maven-javadoc-plugin/ +[36]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ +[37]: http://www.eclipse.org/legal/epl-v10.html +[38]: https://anthonywhitford.com/lombok.maven/lombok-maven-plugin/ +[39]: https://www.jacoco.org/jacoco/trunk/doc/maven.html +[40]: https://www.eclipse.org/legal/epl-2.0/ +[41]: https://github.com/exasol/error-code-crawler-maven-plugin/ +[42]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE +[43]: http://zlika.github.io/reproducible-build-maven-plugin +[44]: http://maven.apache.org/plugins/maven-clean-plugin/ +[45]: http://maven.apache.org/plugins/maven-resources-plugin/ +[46]: http://maven.apache.org/plugins/maven-jar-plugin/ +[47]: http://maven.apache.org/plugins/maven-install-plugin/ +[48]: http://maven.apache.org/plugins/maven-site-plugin/ +[49]: https://github.com/exasol/project-keeper/ +[50]: https://github.com/exasol/project-keeper/blob/main/LICENSE +[51]: https://github.com/eclipse-ee4j/jaxb-api +[52]: https://oss.oracle.com/licenses/CDDL+GPL-1.1 +[53]: https://eclipse-ee4j.github.io/jaxb-ri/ +[54]: https://www.xmlunit.org/ +[55]: https://github.com/Steppschuh/Java-Markdown-Generator +[56]: https://github.com/vdurmont/semver4j +[57]: https://bitbucket.org/snakeyaml/snakeyaml +[58]: https://maven.apache.org/ref/3.8.6/maven-model/ +[59]: https://github.com/exasol/maven-project-version-getter +[60]: https://github.com/exasol/maven-plugin-integration-testing/ +[61]: https://github.com/exasol/maven-plugin-integration-testing/blob/main/LICENSE +[62]: https://maven.apache.org/plugins/maven-jar-plugin/ +[63]: https://maven.apache.org/surefire/maven-failsafe-plugin/ [64]: https://maven.apache.org/plugins/maven-assembly-plugin/ [65]: https://github.com/exasol/artifact-reference-checker-maven-plugin [66]: https://maven.apache.org/plugin-tools/maven-plugin-annotations diff --git a/doc/changes/changes_2.5.1.md b/doc/changes/changes_2.5.1.md index c4af449f..d2b764da 100644 --- a/doc/changes/changes_2.5.1.md +++ b/doc/changes/changes_2.5.1.md @@ -4,13 +4,14 @@ Code name: Fix Golang dependencies ## Summary -This release fixes retrieving of Golang dependencies, it should now work for most Golang projects. +This release fixes retrieving of Golang dependencies, it should now work for most Golang projects. It also generates a script for non-Maven projects that allows to run PK in continuous integration (CI) as well as local builds. ## Features * #321: Added default link replacement for Exasol JDBC driver * #162: Omit heading for empty dependency updates section in changelog * #132: Ensured that the reproducible-build-maven-plugin is the last one in the plugins list +* #338: Generate a script for verifying non-Maven projects ## Bugfixes @@ -32,6 +33,7 @@ This release fixes retrieving of Golang dependencies, it should now work for mos * Updated `org.junit.jupiter:junit-jupiter-engine:5.8.2` to `5.9.0` * Updated `org.junit.jupiter:junit-jupiter-params:5.8.2` to `5.9.0` * Updated `org.mockito:mockito-core:4.6.0` to `4.6.1` +* Added `org.slf4j:slf4j-jdk14:1.7.36` #### Plugin Dependency Updates @@ -57,6 +59,7 @@ This release fixes retrieving of Golang dependencies, it should now work for mos * Updated `org.junit.jupiter:junit-jupiter-engine:5.8.2` to `5.9.0` * Updated `org.junit.jupiter:junit-jupiter-params:5.8.2` to `5.9.0` * Updated `org.mockito:mockito-junit-jupiter:4.6.0` to `4.6.1` +* Added `org.slf4j:slf4j-jdk14:1.7.36` #### Plugin Dependency Updates @@ -93,6 +96,7 @@ This release fixes retrieving of Golang dependencies, it should now work for mos * Updated `org.junit.jupiter:junit-jupiter-engine:5.8.2` to `5.9.0` * Updated `org.junit.jupiter:junit-jupiter-params:5.8.2` to `5.9.0` * Updated `org.mockito:mockito-core:4.6.0` to `4.6.1` +* Added `org.slf4j:slf4j-jdk14:1.7.36` #### Plugin Dependency Updates diff --git a/project-keeper-maven-plugin/pom.xml b/project-keeper-maven-plugin/pom.xml index c8c92826..98a50576 100644 --- a/project-keeper-maven-plugin/pom.xml +++ b/project-keeper-maven-plugin/pom.xml @@ -87,6 +87,12 @@ maven-plugin-integration-testing test + + + org.slf4j + slf4j-jdk14 + test + @@ -122,4 +128,4 @@ - + \ No newline at end of file diff --git a/project-keeper/pom.xml b/project-keeper/pom.xml index 112dced9..52110010 100644 --- a/project-keeper/pom.xml +++ b/project-keeper/pom.xml @@ -105,6 +105,12 @@ equalsverifier test + + + org.slf4j + slf4j-jdk14 + test + @@ -135,4 +141,4 @@ - + \ No newline at end of file diff --git a/project-keeper/src/main/java/com/exasol/projectkeeper/ProjectKeeper.java b/project-keeper/src/main/java/com/exasol/projectkeeper/ProjectKeeper.java index fdbf7e43..7322880a 100644 --- a/project-keeper/src/main/java/com/exasol/projectkeeper/ProjectKeeper.java +++ b/project-keeper/src/main/java/com/exasol/projectkeeper/ProjectKeeper.java @@ -55,8 +55,15 @@ private ProjectKeeper(final Logger logger, final Path projectDir, final Path mvn * @return built {@link ProjectKeeper} */ public static ProjectKeeper createProjectKeeper(final Logger logger, final Path projectDir, final Path mvnRepo) { - final String ownVersion = ProjectKeeper.class.getPackage().getImplementationVersion(); - return new ProjectKeeper(logger, projectDir, mvnRepo, readConfig(projectDir), ownVersion); + return new ProjectKeeper(logger, projectDir, mvnRepo, readConfig(projectDir), getOwnVersion()); + } + + private static String getOwnVersion() { + final String packageVersion = ProjectKeeper.class.getPackage().getImplementationVersion(); + if (packageVersion != null) { + return packageVersion; + } + return "(unknownVersion)"; } /** @@ -133,7 +140,7 @@ private List getPhase2Validators() { final String projectName = getProjectName(analyzedSources); final var brokenLinkReplacer = new BrokenLinkReplacer(this.config.getLinkReplacements()); final String projectVersion = new ProjectVersionDetector().detectVersion(this.config, analyzedSources); - return List.of(new ProjectFilesValidator(this.projectDir, analyzedSources, this.logger), + return List.of(new ProjectFilesValidator(this.projectDir, analyzedSources, this.logger, this.ownVersion), new ReadmeFileValidator(this.projectDir, projectName, this.repoName, analyzedSources), new ChangesFileValidator(projectVersion, projectName, this.projectDir, analyzedSources), new DependenciesValidator(analyzedSources, this.projectDir, brokenLinkReplacer), diff --git a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplate.java b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplate.java index ff2a91e9..412574d6 100644 --- a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplate.java +++ b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplate.java @@ -1,32 +1,34 @@ package com.exasol.projectkeeper.validators.files; +import java.nio.file.Path; + /** Interface for templates for project files. */ public interface FileTemplate { /** * Get the expected content. - * + * * @return expected content */ String getContent(); /** * Get the path of the file in the project. - * + * * @return path */ - java.nio.file.Path getPathInProject(); + Path getPathInProject(); /** * Get the template type - * + * * @return template type */ - TemplateType getTemplateType(); + Validation getValidation(); /** * Types of templates. */ - public enum TemplateType { + public enum Validation { /** * Verify the file has the same content as the template */ diff --git a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplateFromResource.java b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplateFromResource.java index 67381a26..e4464de6 100644 --- a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplateFromResource.java +++ b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplateFromResource.java @@ -10,35 +10,36 @@ */ @EqualsAndHashCode public class FileTemplateFromResource implements FileTemplate { + + private final String templateResource; private final String pathInProject; - private final String pathToTemplate; @Getter - private final TemplateType templateType; + private final Validation validation; /** * Create a new instance of {@link FileTemplateFromResource}. - * + * * @param pathInProject path of the file in the project - * @param templateType type of the template + * @param validation validation criteria for the template */ - public FileTemplateFromResource(final String pathInProject, final TemplateType templateType) { + public FileTemplateFromResource(final String pathInProject, final Validation validation) { + this.templateResource = "templates/" + pathInProject; this.pathInProject = pathInProject; - this.pathToTemplate = pathInProject; - this.templateType = templateType; + this.validation = validation; } /** * Create a new instance of {@link FileTemplateFromResource}. * - * @param pathInProject path of the file in the project - * @param pathToTemplate path to the template - * @param templateType type of the template + * @param templateResource path to the template + * @param pathInProject path of the file in the project + * @param validation validation criteria for the template */ - public FileTemplateFromResource(final String pathInProject, final String pathToTemplate, - final TemplateType templateType) { + public FileTemplateFromResource(final String templateResource, final String pathInProject, + final Validation validation) { + this.templateResource = templateResource; this.pathInProject = pathInProject; - this.pathToTemplate = pathToTemplate; - this.templateType = templateType; + this.validation = validation; } @Override @@ -48,6 +49,6 @@ public Path getPathInProject() { @Override public String getContent() { - return new ResourceReader().readFromResource("templates/" + this.pathInProject); + return new ResourceReader().readFromResource(this.templateResource); } } diff --git a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactory.java b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactory.java index b069342f..9deeb404 100644 --- a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactory.java +++ b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactory.java @@ -1,9 +1,8 @@ package com.exasol.projectkeeper.validators.files; import static com.exasol.projectkeeper.shared.config.ProjectKeeperModule.*; -import static com.exasol.projectkeeper.validators.files.FileTemplate.TemplateType.REQUIRE_EXACT; -import static com.exasol.projectkeeper.validators.files.FileTemplate.TemplateType.REQUIRE_EXIST; -import static java.util.Collections.emptyList; +import static com.exasol.projectkeeper.validators.files.FileTemplate.Validation.REQUIRE_EXACT; +import static com.exasol.projectkeeper.validators.files.FileTemplate.Validation.REQUIRE_EXIST; import java.util.*; @@ -12,14 +11,17 @@ import com.exasol.projectkeeper.shared.config.ProjectKeeperModule; import com.exasol.projectkeeper.sources.*; -import lombok.RequiredArgsConstructor; - /** * Factory for file templates. */ -@RequiredArgsConstructor class FileTemplatesFactory { private final Logger logger; + private final String ownVersion; + + public FileTemplatesFactory(final Logger logger, final String ownVersion) { + this.logger = logger; + this.ownVersion = ownVersion; + } List getGlobalTemplates(final List sources) { final List templates = new ArrayList<>(); @@ -32,6 +34,8 @@ List getGlobalTemplates(final List sources) { templates.add(new FileTemplateFromResource( ".github/workflows/release_droid_release_on_maven_central.yml", REQUIRE_EXACT)); } + } else if (onlyGolangProjects(sources)) { + templates.addAll(getGolangTemplates()); } else { this.logger.warn(ExaError.messageBuilder("W-PK-CORE-91") .message("For this project structure project keeper does not know how to configure ci-build.") @@ -56,8 +60,8 @@ private List getGenericMavenTemplates(final Set modules) { if (modules.contains(NATIVE_IMAGE)) { - return new FileTemplateFromResource(".github/workflows/ci-build.yml", - ".github/workflows/ci-build-native-image.yml", REQUIRE_EXACT); + return new FileTemplateFromResource("templates/.github/workflows/ci-build-native-build.yml", + ".github/workflows/ci-build.yml", REQUIRE_EXACT); } else { return new FileTemplateFromResource(".github/workflows/ci-build.yml", REQUIRE_EXACT); } @@ -67,6 +71,10 @@ private boolean isMvnRootProject(final AnalyzedSource source) { return (source instanceof AnalyzedMavenSource) && (((AnalyzedMavenSource) source).isRootProject()); } + private boolean onlyGolangProjects(final List sources) { + return sources.stream().allMatch(AnalyzedGolangSource.class::isInstance); + } + List getTemplatesForSource(final AnalyzedSource source) { if (source instanceof AnalyzedMavenSource) { return getMavenTemplates((AnalyzedMavenSource) source); @@ -101,6 +109,10 @@ private List getMavenTemplates(final AnalyzedMavenSource source) { } private List getGolangTemplates() { - return emptyList(); + final ArrayList templates = new ArrayList<>(); + final String pathInProject = ".github/workflows/project-keeper-verify.yml"; + templates.add(new FileTemplateFromResource("golang_templates/" + pathInProject, pathInProject, REQUIRE_EXACT)); + templates.add(new ProjectKeeperShellScript(this.ownVersion)); + return templates; } } diff --git a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidator.java b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidator.java index 79a6f8af..760299fb 100644 --- a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidator.java +++ b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidator.java @@ -23,24 +23,28 @@ public class ProjectFilesValidator implements Validator { private final Path projectDirectory; private final List sources; private final Logger logger; + private final String ownVersion; /** * Crate a new instance of {@link ProjectFilesValidator}. - * + * * @param projectDirectory project's root directory * @param sources list of sources * @param logger logger + * @param ownVersion the version of the currently running project keeper */ - public ProjectFilesValidator(final Path projectDirectory, final List sources, final Logger logger) { + public ProjectFilesValidator(final Path projectDirectory, final List sources, final Logger logger, + final String ownVersion) { this.projectDirectory = projectDirectory; this.sources = sources; this.logger = logger; + this.ownVersion = ownVersion; } @Override public List validate() { final List findings = new ArrayList<>(); - final FileTemplatesFactory templatesFactory = new FileTemplatesFactory(this.logger); + final FileTemplatesFactory templatesFactory = new FileTemplatesFactory(this.logger, this.ownVersion); findings.addAll(validateTemplatesRelativeToRepo(templatesFactory)); findings.addAll(validateTemplatesRelativeToSource(templatesFactory)); return findings; @@ -84,14 +88,14 @@ private List validate(final Path projectDirectory, final File } private ContentValidator getContentValidator(final FileTemplate template) { - switch (template.getTemplateType()) { + switch (template.getValidation()) { case REQUIRE_EXACT: return withContentEqualTo(template.getContent()); case REQUIRE_EXIST: return fileExists(template.getContent()); default: throw new IllegalStateException(ExaError.messageBuilder("E-PK-CORE-119") - .message("Unknown template type {{template type}}", template.getTemplateType()).ticketMitigation() + .message("Unknown template type {{template type}}", template.getValidation()).ticketMitigation() .toString()); } } diff --git a/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectKeeperShellScript.java b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectKeeperShellScript.java new file mode 100644 index 00000000..2c556ad3 --- /dev/null +++ b/project-keeper/src/main/java/com/exasol/projectkeeper/validators/files/ProjectKeeperShellScript.java @@ -0,0 +1,31 @@ +package com.exasol.projectkeeper.validators.files; + +import java.nio.file.Path; +import java.nio.file.Paths; + +class ProjectKeeperShellScript implements FileTemplate { + private static final String TEMPLATE_PATH = ".github/workflows/project-keeper.sh"; + + private final String ownVersion; + + ProjectKeeperShellScript(final String ownVersion) { + this.ownVersion = ownVersion; + } + + @Override + public String getContent() { + String template = new ResourceReader().readFromResource("non_maven_templates/" + TEMPLATE_PATH); + template = template.replace("##VERSION##", this.ownVersion); + return template; + } + + @Override + public Path getPathInProject() { + return Paths.get(TEMPLATE_PATH); + } + + @Override + public Validation getValidation() { + return Validation.REQUIRE_EXACT; + } +} diff --git a/project-keeper/src/main/resources/golang_templates/.github/workflows/project-keeper-verify.yml b/project-keeper/src/main/resources/golang_templates/.github/workflows/project-keeper-verify.yml new file mode 100644 index 00000000..06e627f1 --- /dev/null +++ b/project-keeper/src/main/resources/golang_templates/.github/workflows/project-keeper-verify.yml @@ -0,0 +1,55 @@ +name: Project Keeper Verify + +on: + push: + branches: + - main + pull_request: + +jobs: + project-keeper-verify: + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - name: Cache Project Keeper + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pk-${{ hashFiles('.github/workflows/project-keeper.sh') }} + restore-keys: | + ${{ runner.os }}-pk- + + - name: Cache go-licenses + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-licenses-${{ hashFiles('.github/workflows/project-keeper-verify.yml') }} + restore-keys: | + ${{ runner.os }}-go-licenses-${{ hashFiles('.github/workflows/project-keeper-verify.yml') }} + ${{ runner.os }}-go-licenses- + + - name: Install go-licenses + run: go install github.com/google/go-licenses@v1.2.1 + + - name: Project Keeper Verify + run: ./.github/workflows/project-keeper.sh diff --git a/project-keeper/src/main/resources/non_maven_templates/.github/workflows/project-keeper.sh b/project-keeper/src/main/resources/non_maven_templates/.github/workflows/project-keeper.sh new file mode 100644 index 00000000..cdd42dfa --- /dev/null +++ b/project-keeper/src/main/resources/non_maven_templates/.github/workflows/project-keeper.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +readonly pk_mode="${1-verify}"; +readonly version="##VERSION##" + +readonly pk_jar="$HOME/.m2/repository/com/exasol/project-keeper-cli/$version/project-keeper-cli-$version.jar" + +if [ ! -f "$pk_jar" ]; then + echo "Downloading Using Project Keeper $version" + mvn --batch-mode org.apache.maven.plugins:maven-dependency-plugin:3.3.0:get -Dartifact=com.exasol:project-keeper-cli:$version +fi + +echo "Running Project Keeper with mode $pk_mode from $pk_jar" +java -jar "$pk_jar" "$pk_mode" diff --git a/project-keeper/src/test/java/com/exasol/projectkeeper/ProjectKeeperGolangIT.java b/project-keeper/src/test/java/com/exasol/projectkeeper/ProjectKeeperGolangIT.java index 60048cf4..b562a532 100644 --- a/project-keeper/src/test/java/com/exasol/projectkeeper/ProjectKeeperGolangIT.java +++ b/project-keeper/src/test/java/com/exasol/projectkeeper/ProjectKeeperGolangIT.java @@ -6,9 +6,11 @@ import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Paths; import org.junit.jupiter.api.*; +import com.exasol.mavenprojectversiongetter.MavenProjectVersionGetter; import com.exasol.projectkeeper.test.GolangProjectFixture; @Tag("integration") @@ -34,13 +36,14 @@ void fixingSolvesAllIssues() throws IOException { prepareProjectFiles(); runFix(); assertVerifySucceeds(); - assertGeneratedFiles(); + assertGeneratedDependencyFiles(); + assertGeneratedVerifyWorkflow(); } // [itest -> dsn~golang-project-version~1] // [itest -> dsn~golang-dependency-licenses~1] // [itest -> dsn~golang-changed-dependency~1] - private void assertGeneratedFiles() throws IOException { + private void assertGeneratedDependencyFiles() throws IOException { final String dependencies = Files.readString(this.projectDir.resolve("dependencies.md")); final String changelog = Files .readString(this.projectDir.resolve("doc/changes/changes_" + this.fixture.getProjectVersion() + ".md")); @@ -51,6 +54,16 @@ private void assertGeneratedFiles() throws IOException { containsString("| github.com/exasol/exasol-test-setup-abstraction-server/go-client | [MIT][1]"))); } + private void assertGeneratedVerifyWorkflow() throws IOException { + final String currentVersion = MavenProjectVersionGetter.getProjectRevision(Paths.get("../parent-pom/pom.xml")); + final String workflowFile = Files + .readString(this.projectDir.resolve(".github/workflows/project-keeper-verify.yml")); + final String shellScript = Files.readString(this.projectDir.resolve(".github/workflows/project-keeper.sh")); + assertThat(workflowFile, allOf(containsString("run: go install github.com/google/go-licenses@"), + containsString("run: ./.github/workflows/project-keeper.sh"))); + assertThat(shellScript, containsString("readonly version=\"" + currentVersion + "\"")); + } + @Test void testVerifyPhase2() throws IOException { prepareProjectFiles(); diff --git a/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactoryTest.java b/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactoryTest.java index e60a5742..f60fee24 100644 --- a/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactoryTest.java +++ b/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/FileTemplatesFactoryTest.java @@ -19,12 +19,14 @@ import com.exasol.projectkeeper.sources.AnalyzedSource; class FileTemplatesFactoryTest { + private static final String OWN_VERSION = "version"; @Test void testGetCiBuildTemplatesForMavenProject() { final Set modules = Collections.emptySet(); final List sources = getMavenSourceWithModules(modules); - final List templates = new FileTemplatesFactory(mock(Logger.class)).getGlobalTemplates(sources); + final List templates = new FileTemplatesFactory(mock(Logger.class), OWN_VERSION) + .getGlobalTemplates(sources); assertContainsTemplate(templates, ".github/workflows/ci-build.yml"); } @@ -41,7 +43,7 @@ void testGetCiBuildTemplatesForNonAggregatedMvnProject() { final Logger logger = mock(Logger.class); final List sources = List .of(AnalyzedMavenSource.builder().modules(Collections.emptySet()).isRootProject(false).build()); - final List templates = new FileTemplatesFactory(logger).getGlobalTemplates(sources); + final List templates = new FileTemplatesFactory(logger, OWN_VERSION).getGlobalTemplates(sources); assertFalse(() -> templates.stream() .anyMatch(template -> template.getPathInProject().equals(Path.of(".github/workflows/ci-build.yml")))); verify(logger).warn( @@ -51,7 +53,8 @@ void testGetCiBuildTemplatesForNonAggregatedMvnProject() { @Test void testGetMavenCentralCiBuildTemplatesForMavenProject() { final List sources = getMavenSourceWithModules(Set.of(MAVEN_CENTRAL)); - final List templates = new FileTemplatesFactory(mock(Logger.class)).getGlobalTemplates(sources); + final List templates = new FileTemplatesFactory(mock(Logger.class), OWN_VERSION) + .getGlobalTemplates(sources); assertContainsTemplate(templates, ".github/workflows/release_droid_release_on_maven_central.yml"); } @@ -64,7 +67,8 @@ void testGetMavenCentralCiBuildTemplatesForMavenProject() { }) void testGetTemplatesPerSource(final ProjectKeeperModule module, final String expectedTemplate) { final AnalyzedMavenSource source = AnalyzedMavenSource.builder().modules(Set.of(module)).build(); - final List templates = new FileTemplatesFactory(mock(Logger.class)).getTemplatesForSource(source); + final List templates = new FileTemplatesFactory(mock(Logger.class), OWN_VERSION) + .getTemplatesForSource(source); assertContainsTemplate(templates, expectedTemplate); } diff --git a/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidatorTest.java b/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidatorTest.java index 5d56f62c..99c890ee 100644 --- a/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidatorTest.java +++ b/project-keeper/src/test/java/com/exasol/projectkeeper/validators/files/ProjectFilesValidatorTest.java @@ -28,7 +28,9 @@ //[utest->dsn~required-files-validator~1] class ProjectFilesValidatorTest { + private static final String OWN_VERSION = "version"; private static final Set DEFAULT_MODULE = Set.of(ProjectKeeperModule.DEFAULT); + @TempDir Path tempDir; @@ -37,7 +39,7 @@ void testValidation() throws IOException { Files.createDirectories(this.tempDir.resolve(".settings")); Files.createFile(this.tempDir.resolve(Path.of(".settings", "org.eclipse.jdt.ui.prefs"))); final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); assertThat(validator, validationErrorMessages( hasItems("E-PK-CORE-17: Missing required file: '.settings/org.eclipse.jdt.core.prefs'", @@ -52,14 +54,14 @@ private List getMvnSourceWithDefaultModule() { @Test void testFix() { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); assertThat(validator, hasNoMoreFindingsAfterApplyingFixes()); } @Test void testDifferentContent() throws IOException { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); fixAllFindings(validator); final Path testFile = this.tempDir.resolve(".settings/org.eclipse.jdt.core.prefs"); changeFile(testFile); @@ -70,7 +72,7 @@ void testDifferentContent() throws IOException { @Test void testFixDifferentContent() throws IOException { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); fixAllFindings(validator); final Path testFile = this.tempDir.resolve(Path.of(".settings", "org.eclipse.jdt.core.prefs")); changeFile(testFile); @@ -80,7 +82,7 @@ void testFixDifferentContent() throws IOException { @Test void testMissingFileWithAnyContent() throws IOException { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); fixAllFindings(validator); final Path testFile = this.tempDir.resolve("release_config.yml"); deleteFile(testFile); @@ -91,7 +93,7 @@ void testMissingFileWithAnyContent() throws IOException { @Test void testRequireExistsIgnoresContent() throws IOException { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); fixAllFindings(validator); final Path testFile = this.tempDir.resolve("release_config.yml"); changeFile(testFile); @@ -101,7 +103,7 @@ void testRequireExistsIgnoresContent() throws IOException { @Test void testRequireExistsDoesNotModifyContent() throws IOException { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); fixAllFindings(validator); final Path testFile = this.tempDir.resolve("release_config.yml"); changeFile(testFile); @@ -113,7 +115,7 @@ void testRequireExistsDoesNotModifyContent() throws IOException { @Test void testFixMissingFileWithAnyContent() throws IOException { final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, getMvnSourceWithDefaultModule(), - mock(Logger.class)); + mock(Logger.class), OWN_VERSION); fixAllFindings(validator); final Path testFile = this.tempDir.resolve("release_config.yml"); deleteFile(testFile); @@ -129,7 +131,8 @@ void testMultiSourceProject() { .isRootProject(true).build(), AnalyzedMavenSource.builder().path(this.tempDir.resolve("sub-project/pom.xml")).modules(DEFAULT_MODULE) .isRootProject(false).build()); - final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, sources, mock(Logger.class)); + final ProjectFilesValidator validator = new ProjectFilesValidator(this.tempDir, sources, mock(Logger.class), + OWN_VERSION); fixAllFindings(validator); assertAll(// () -> assertThat(this.tempDir.resolve(".github/workflows/ci-build.yml").toFile(), anExistingFile()), diff --git a/shared-model-classes/pom.xml b/shared-model-classes/pom.xml index 40176dc8..8456a55f 100644 --- a/shared-model-classes/pom.xml +++ b/shared-model-classes/pom.xml @@ -72,6 +72,12 @@ mockito-core test + + + org.slf4j + slf4j-jdk14 + test + https://github.com/exasol/project-keeper/