Skip to content

Commit

Permalink
Avoid using non existing maven settings
Browse files Browse the repository at this point in the history
Null check on mavenSettings.
Do not pass non-existent maven settings file to surefire and failsafe plugin.
Fix nearby typos, deprecated API usage and perform code cleanup.
Use ci settings.xml full path.

Fixes #28090

Signed-off-by: Adler Fleurant <[email protected]>
  • Loading branch information
AdlerFleurant committed Sep 22, 2022
1 parent 0ed36ef commit ff5d3b0
Show file tree
Hide file tree
Showing 19 changed files with 136 additions and 108 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ concurrency:
env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
COMMON_MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end"
COMMON_MAVEN_ARGS: "-e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml --fail-at-end"
NATIVE_TEST_MAVEN_ARGS: "-Dtest-containers -Dstart-containers -Dquarkus.native.native-image-xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install -DskipDocs"
JVM_TEST_MAVEN_ARGS: "-Dtest-containers -Dstart-containers -Dformat.skip -DskipDocs -Dquarkus.test.hang-detection-timeout=60"
DB_USER: hibernate_orm_test
Expand Down Expand Up @@ -606,7 +606,7 @@ jobs:
run: |
git clone https://github.com/quarkusio/quarkus-quickstarts.git && cd quarkus-quickstarts
git checkout development
export LANG=en_US && ./mvnw -e -B -fae --settings .github/mvn-settings.xml clean verify -DskipTests
export LANG=en_US && ./mvnw -e -B -fae --settings ${{ github.workspace }}/.github/mvn-settings.xml clean verify -DskipTests
- name: Upload build reports (if build failed)
uses: actions/upload-artifact@v3
if: ${{ failure() || cancelled() }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci-actions.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ concurrency:
env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
NATIVE_TEST_MAVEN_OPTS: "-B --settings .github/mvn-settings.xml --fail-at-end -Dquarkus.native.container-build=true -Dtest-containers -Dstart-containers -Dnative-image.xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install -DskipDocs"
JVM_TEST_MAVEN_OPTS: "-e -B --settings .github/mvn-settings.xml -Dtest-containers -Dstart-containers -Dformat.skip -DskipDocs"
NATIVE_TEST_MAVEN_OPTS: "-B --settings ${{ github.workspace }}/.github/mvn-settings.xml --fail-at-end -Dquarkus.native.container-build=true -Dtest-containers -Dstart-containers -Dnative-image.xmx=5g -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests install -DskipDocs"
JVM_TEST_MAVEN_OPTS: "-e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -Dtest-containers -Dstart-containers -Dformat.skip -DskipDocs"
DB_USER: hibernate_orm_test
DB_PASSWORD: hibernate_orm_test
DB_NAME: hibernate_orm_test
Expand Down Expand Up @@ -95,11 +95,11 @@ jobs:
key: q2maven-${{ steps.get-date.outputs.date }}
- name: Build
run: |
./mvnw -T1C -e -B -DskipTests -DskipITs -Dinvoker.skip -Dno-format -Dtcks --settings .github/mvn-settings.xml clean install
./mvnw -T1C -e -B -DskipTests -DskipITs -Dinvoker.skip -Dno-format -Dtcks --settings ${{ github.workspace }}/.github/mvn-settings.xml clean install
- name: Verify extension dependencies
shell: bash
run: |
./update-extension-dependencies.sh -B --settings .github/mvn-settings.xml
./update-extension-dependencies.sh -B --settings ${{ github.workspace }}/.github/mvn-settings.xml
if [ `git status -s -u no '*pom.xml' | wc -l` -ne 0 ]
then
echo -e '\033[0;31mError:\033[0m Dependencies to extension artifacts are outdated! Run ./update-extension-dependencies.sh and add the modified pom.xml files to your commit.' 1>&2
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
run: tar -xzf maven-repo.tgz -C ~
- name: Build with Maven
shell: bash
run: ./mvnw -B --settings .github/mvn-settings.xml -DskipDocs -Dformat.skip -pl !integration-tests/gradle -pl !integration-tests/maven -pl !integration-tests/devtools install
run: ./mvnw -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -DskipDocs -Dformat.skip -pl !integration-tests/gradle -pl !integration-tests/maven -pl !integration-tests/devtools install
- name: Prepare failure archive (if maven failed)
if: failure()
shell: bash
Expand Down Expand Up @@ -498,10 +498,10 @@ jobs:
shell: bash
run: tar -xzf maven-repo.tgz -C ~
- name: Run RESTEasy Reactive TCK
run: mvn -B --settings ../tcks/.github/mvn-settings.xml install
run: mvn -B --settings ../tcks/${{ github.workspace }}/.github/mvn-settings.xml install
working-directory: ./resteasy-reactive-testsuite
- name: Verify with Maven
run: ../mvnw -B --settings .github/mvn-settings.xml -f tcks/pom.xml install
run: ../mvnw -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -f tcks/pom.xml install
working-directory: ./tcks
- name: Prepare failure archive (if maven failed)
if: failure()
Expand Down Expand Up @@ -576,7 +576,7 @@ jobs:
# done because there is no good way to pass strings with empty values to the previous command
# so this hack is as good as any
if [ "$CATEGORY" == "Misc1" ]; then
./mvnw -Dnative -Dquarkus.native.container-build=true -B --settings .github/mvn-settings.xml -f 'integration-tests/simple with space/' verify
./mvnw -Dnative -Dquarkus.native.container-build=true -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -f 'integration-tests/simple with space/' verify
fi
- name: Prepare failure archive (if maven failed)
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-fork-mvn-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
key: q2maven-${{ steps.get-date.outputs.date }}
- name: Build
run: |
./mvnw -T1C -e -B --settings .github/mvn-settings.xml -Dquickly-ci -Dtcks clean install
./mvnw -T1C -e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -Dquickly-ci -Dtcks clean install
- name: Delete Local Artifacts From Cache
shell: bash
run: rm -r ~/.m2/repository/io/quarkus
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- if: matrix.language == 'java'
name: Build Java
run: ./mvnw -B --settings .github/mvn-settings.xml -Dquickly-ci install
run: ./mvnw -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -Dquickly-ci install

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/deploy-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
SERVER_USERNAME: ${{ secrets.SERVER_USERNAME }}
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
run: |
./mvnw -e -B --settings .github/mvn-settings.xml \
./mvnw -e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml \
-DskipTests -DskipITs -Dno-format -Dinvoker.skip=true \
-DretryFailedDeploymentCount=10 \
-pl !integration-tests/gradle \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:
key: q2maven-doc-${{ steps.get-date.outputs.date }}
- name: Build
run: |
./mvnw -Dquickly-ci -B -DskipDocs=false --settings .github/mvn-settings.xml install
./mvnw -Dquickly-ci -B -DskipDocs=false --settings ${{ github.workspace }}/.github/mvn-settings.xml install
- name: Build Docs
run: |
./mvnw -e -B --settings .github/mvn-settings.xml clean org.asciidoctor:asciidoctor-maven-plugin:process-asciidoc -pl docs -Ddocumentation-pdf
./mvnw -e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml clean org.asciidoctor:asciidoctor-maven-plugin:process-asciidoc -pl docs -Ddocumentation-pdf
2 changes: 1 addition & 1 deletion .github/workflows/jakarta-rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
SERVER_USERNAME: ${{ secrets.SERVER_USERNAME }}
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
run: |
./mvnw -e -B --settings .github/mvn-settings.xml \
./mvnw -e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml \
-DskipITs -DskipTests -Dskip.gradle.tests -Dno-format -Dinvoker.skip=true \
-DretryFailedDeploymentCount=10 \
-pl !integration-tests/gradle \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jdk-early-access-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
MAVEN_OPTS: -Xmx2g -XX:MaxMetaspaceSize=1g
JVM_TEST_MAVEN_OPTS: "-e -B --settings .github/mvn-settings.xml -Dtest-containers -Dstart-containers -Dtest-resteasy-reactive-large-files -Dformat.skip"
JVM_TEST_MAVEN_OPTS: "-e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -Dtest-containers -Dstart-containers -Dtest-resteasy-reactive-large-files -Dformat.skip"
DB_USER: hibernate_orm_test
DB_PASSWORD: hibernate_orm_test
DB_NAME: hibernate_orm_test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/native-cron-build.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: ./mvnw -B install -DskipTests -DskipITs -Dformat.skip

- name: Run integration tests in native
run: ./mvnw -B --settings .github/mvn-settings.xml verify -f integration-tests/pom.xml --fail-at-end -Dno-format -Dtest-containers -Dstart-containers -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:22.2-java${{ matrix.java }} -pl '!io.quarkus:quarkus-integration-test-google-cloud-functions-http,!io.quarkus:quarkus-integration-test-google-cloud-functions,!io.quarkus:quarkus-integration-test-funqy-google-cloud-functions'
run: ./mvnw -B --settings ${{ github.workspace }}/.github/mvn-settings.xml verify -f integration-tests/pom.xml --fail-at-end -Dno-format -Dtest-containers -Dstart-containers -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:22.2-java${{ matrix.java }} -pl '!io.quarkus:quarkus-integration-test-google-cloud-functions-http,!io.quarkus:quarkus-integration-test-google-cloud-functions,!io.quarkus:quarkus-integration-test-funqy-google-cloud-functions'

- name: Report
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: mkdir -p $HOME/release/repository
- name: Build and Test
run: |
./mvnw --settings .github/mvn-settings.xml \
./mvnw --settings ${{ github.workspace }}/.github/mvn-settings.xml \
-B \
-Prelease \
-DskipTests -DskipITs \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./mvnw -e -B --settings .github/mvn-settings.xml -Dquickly-ci install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.organization=quarkusio -Dsonar.projectKey=quarkusio_quarkus -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectName=Quarkus -Dsonar.java.libraries=/home/runner/.m2/repository/**/*.jar
run: ./mvnw -e -B --settings ${{ github.workspace }}/.github/mvn-settings.xml -Dquickly-ci install org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.organization=quarkusio -Dsonar.projectKey=quarkusio_quarkus -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectName=Quarkus -Dsonar.java.libraries=/home/runner/.m2/repository/**/*.jar
36 changes: 34 additions & 2 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
<!-- some dev tools tests need the following properties -->
<project.version>${project.version}</project.version>
<project.groupId>${project.groupId}</project.groupId>
Expand All @@ -461,7 +460,6 @@
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
<!-- some dev tools tests need the following properties -->
<project.version>${project.version}</project.version>
<project.groupId>${project.groupId}</project.groupId>
Expand Down Expand Up @@ -1281,5 +1279,39 @@
</plugins>
</build>
</profile>

<profile>
<id>user-session-settings</id>
<activation>
<file>
<exists>${session.request.userSettingsFile.path}</exists>
</file>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<!-- combine.self suppresses warnings about java.io.tmpdir being defined twice -->
<systemPropertyVariables combine.self="override">
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
3 changes: 1 addition & 2 deletions core/runtime/src/main/java/io/quarkus/runtime/Quarkus.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void run(Class<? extends QuarkusApplication> quarkusApplication, B
//we already have an application, run it directly
Class<? extends Application> appClass = (Class<? extends Application>) Class.forName(Application.APP_CLASS_NAME,
false, Thread.currentThread().getContextClassLoader());
Application application = appClass.newInstance();
Application application = appClass.getDeclaredConstructor().newInstance();
ApplicationLifecycleManager.run(application, quarkusApplication, exitHandler, args);
return;
} catch (ClassNotFoundException e) {
Expand All @@ -84,7 +84,6 @@ public static void run(Class<? extends QuarkusApplication> quarkusApplication, B
//this is not the quarkus:dev path as it will augment before
//calling this method
launchFromIDE(quarkusApplication, args);

}

private static void launchFromIDE(Class<? extends QuarkusApplication> quarkusApplication, String... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void testCreateExtensionDefaults() throws Exception {
CreateExtension.DEFAULT_QUARKIVERSE_VERSION);
Path quarkusExtension = project.resolve("runtime/src/main/resources/META-INF/quarkus-extension.yaml");
Assertions.assertTrue(quarkusExtension.toFile().exists(),
"quarkus-extension.yaml should exist: " + quarkusExtension.toAbsolutePath().toString());
"quarkus-extension.yaml should exist: " + quarkusExtension.toAbsolutePath());

Path deploymentPom = project.resolve("deployment/pom.xml");
validateBasicIdentifiers(deploymentPom, // <parent> pom
Expand All @@ -112,8 +112,8 @@ public void testCreateExtensionDefaults() throws Exception {
"io.quarkiverse.custom",
"quarkus-custom-deployment",
CreateExtension.DEFAULT_QUARKIVERSE_VERSION);
CliDriver.valdiateGeneratedSourcePackage(project.resolve("deployment"), "io/quarkiverse/custom/deployment");
CliDriver.valdiateGeneratedTestPackage(project.resolve("deployment"), "io/quarkiverse/custom/test");
CliDriver.validateGeneratedSourcePackage(project.resolve("deployment"), "io/quarkiverse/custom/deployment");
CliDriver.validateGeneratedTestPackage(project.resolve("deployment"), "io/quarkiverse/custom/test");

Path itPom = project.resolve("integration-tests/pom.xml");
validateBasicIdentifiers(itPom, // <parent> pom
Expand All @@ -124,8 +124,8 @@ public void testCreateExtensionDefaults() throws Exception {
"io.quarkiverse.custom",
"quarkus-custom-integration-tests",
CreateExtension.DEFAULT_QUARKIVERSE_VERSION);
CliDriver.valdiateGeneratedSourcePackage(project.resolve("integration-tests"), "io/quarkiverse/custom/it");
CliDriver.valdiateGeneratedTestPackage(project.resolve("integration-tests"), "io/quarkiverse/custom/it");
CliDriver.validateGeneratedSourcePackage(project.resolve("integration-tests"), "io/quarkiverse/custom/it");
CliDriver.validateGeneratedTestPackage(project.resolve("integration-tests"), "io/quarkiverse/custom/it");
}

@Test
Expand All @@ -149,30 +149,30 @@ public void testCreateExtension() throws Exception {
"org.my", "something", "0.1");
Path quarkusExtension = project.resolve("runtime/src/main/resources/META-INF/quarkus-extension.yaml");
Assertions.assertTrue(quarkusExtension.toFile().exists(),
"quarkus-extension.yaml should exist: " + quarkusExtension.toAbsolutePath().toString());
"quarkus-extension.yaml should exist: " + quarkusExtension.toAbsolutePath());

Path deploymentPom = project.resolve("deployment/pom.xml");
validateBasicIdentifiers(deploymentPom, // <parent> pom
"org.my", "something-parent", "0.1");
validateBasicIdentifiers(deploymentPom,
"org.my", "something-deployment", "0.1");
CliDriver.valdiateGeneratedSourcePackage(project.resolve("deployment"), "org/my/something/deployment");
CliDriver.valdiateGeneratedTestPackage(project.resolve("deployment"), "org/my/something/test");
CliDriver.validateGeneratedSourcePackage(project.resolve("deployment"), "org/my/something/deployment");
CliDriver.validateGeneratedTestPackage(project.resolve("deployment"), "org/my/something/test");

Path itPom = project.resolve("integration-tests/pom.xml");
validateBasicIdentifiers(itPom, // <parent> pom
"org.my", "something-parent", "0.1");
validateBasicIdentifiers(itPom,
"org.my", "something-integration-tests", "0.1");
CliDriver.valdiateGeneratedSourcePackage(project.resolve("integration-tests"), "org/my/something/it");
CliDriver.valdiateGeneratedTestPackage(project.resolve("integration-tests"), "org/my/something/it");
CliDriver.validateGeneratedSourcePackage(project.resolve("integration-tests"), "org/my/something/it");
CliDriver.validateGeneratedTestPackage(project.resolve("integration-tests"), "org/my/something/it");
}

String validateBasicIdentifiers(Path pom, String group, String artifact, String version) throws Exception {
Assertions.assertTrue(pom.toFile().exists(),
"pom.xml should exist: " + pom.toAbsolutePath().toString());
"pom.xml should exist: " + pom.toAbsolutePath());

String pomContent = CliDriver.readFileAsString(project, pom);
String pomContent = CliDriver.readFileAsString(pom);
Assertions.assertTrue(pomContent.contains("<groupId>" + group + "</groupId>"),
pom + " should contain group id " + group + ":\n" + pomContent);
Assertions.assertTrue(pomContent.contains("<artifactId>" + artifact + "</artifactId>"),
Expand Down
Loading

0 comments on commit ff5d3b0

Please sign in to comment.