Describe the bug
In Quarkus 1.4.1.Final, test dependencies resolved during Quarkus test execution are always retrieved from "central", ignoring custom repository, if ${revision} placeholder is used for version as defined in Maven documentation and a custom repository is defined in settings.xml as defined in Maven documentation
Note that this bug does not occur if the custom repository is defined in pom.xml. However, ignoring repositories defined in settings.xml is an issue and should be resolved. Additionally, it is not possible to configure credentials in pom.xml, so any private repository that requires authentication will not function even with this workaround.
Expected behavior
All dependencies, including those resolved by Quarkus test runner, should be resolved using repositories defined in standard Maven configuration.
Actual behavior
Dependencies resolved during Quarkus test execution ignore settings.xml and instead all pull from the default repository of "central".
To Reproduce
Full reproduction details and test case are located at https://github.com/jeffhubLR/quarkus-1.4.1-maven-regression
Environment (please complete the following information):
uname -a or ver: Darwin xxxxx 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64java -version: openjdk version "11.0.6" 2020-01-14mvnw --version or gradlew --version): Regression occurs regardless of using mvnw or direct mvn../mvnw --version:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/jeff.hubbach/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.6, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"
mvn --version:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 11.0.6, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"
Additional context
Sections copied from demonstration repository README.md:
Maven ${revision}
Since 3.5.0-beta-1, maven has supported using a ${revision} placeholder for the version in pom files.
https://maven.apache.org/maven-ci-friendly.html
This is often used in CI systems to be able to inject version at build time via mvn -Drevision=1.2.3 package
Companies frequently require all dependencies to be pulled through an internal Maven repository that also proxies upstream. One easy way to accomplish this is by providing a settings.xml file that specifies that repository. For the purpose of this demonstration, we just override the name but leave the repository as Maven Central.
All dependencies should be retrieved from "get-all-from-here" repository. If at any point we see dependencies pulled from "central", that proves our Maven configuration is not being honored.
On Quarkus 1.4.1.Final with a custom repository defined and
/cc @quarkusio/devtools
May be related to #6067 but as it was working in 1.3.2 and stopped working in 1.4.1, and I had a more specific replication case, I chose to create a new issue.
Thanks a lot for the the detailed report and the reproducer. This issue is fixed in #8864.
@aloubyansky I tested your PR and it did not resolve this issue. Artifacts resolved during Quarkus test execution are not pulled from the Maven repository configured in ~/.m2/settings.xml.
Interesting, I did try your reproducer on that branch.
i didn't copy the settings.xml to the repo location though but used -s instead. I'll try again.
I'm re-verifying as well.
Verified as not resolving this issue:
mvn test ✔
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ code-with-quarkus ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/jeff.hubbach/workspace/playground/quarkus-1.4.1-maven-regression/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jeff.hubbach/workspace/playground/quarkus-1.4.1-maven-regression/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ code-with-quarkus ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/jeff.hubbach/workspace/playground/quarkus-1.4.1-maven-regression/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ code-with-quarkus ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.ExampleResourceTest
Downloading from central: https://repo.maven.apache.org/maven2/org/graalvm/nativeimage/svm/19.3.1/svm-19.3.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/graalvm/nativeimage/svm/19.3.1/svm-19.3.1.jar (0 B at 0 B/s)
2020-04-28 11:12:20,131 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 1.018s. Listening on: http://0.0.0.0:8081
2020-04-28 11:12:20,133 INFO [io.quarkus] (main) Profile test activated.
2020-04-28 11:12:20,133 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.627 s - in org.acme.ExampleResourceTest
2020-04-28 11:12:21,154 INFO [io.quarkus] (main) Quarkus stopped in 0.025s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.401 s
[INFO] Finished at: 2020-04-28T11:12:21-06:00
[INFO] ------------------------------------------------------------------------
Note the lines where svm dependency is downloaded from central. That should say "from get-all-from-here".
I also verified it failing when executing mvn test -s setup/settings.xml
In order to not nuke the compiled quarkus, you can use this rm command to ensure a dependency will need to be downloaded:
rm -Rf ~/.m2/repository/org/graalvm/nativeimage
Here is what I'm seeing running
[olubyans@fedovo quarkus-1.4.1-maven-regression]$ mvn clean test -s setup/settings.xml`
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.ExampleResourceTest
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.pom (8.3 kB at 9.2 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/3.3.3/wagon-provider-api-3.3.3.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/3.3.3/wagon-provider-api-3.3.3.pom (1.9 kB at 11 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/3.3.3/wagon-3.3.3.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon/3.3.3/wagon-3.3.3.pom (21 kB at 225 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/jboss-parent/28/jboss-parent-28.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/jboss-parent/28/jboss-parent-28.pom (35 kB at 113 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/jakarta/servlet/jakarta.servlet-api/4.0.3/jakarta.servlet-api-4.0.3.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/jakarta/servlet/jakarta.servlet-api/4.0.3/jakarta.servlet-api-4.0.3.pom (17 kB at 58 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-web/11.0.0.Final/jboss-metadata-web-11.0.0.Final.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-web/11.0.0.Final/jboss-metadata-web-11.0.0.Final.pom (4.7 kB at 15 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-as-parent-metadata/11.0.0.Final/jboss-as-parent-metadata-11.0.0.Final.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-as-parent-metadata/11.0.0.Final/jboss-as-parent-metadata-11.0.0.Final.pom (17 kB at 83 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/jboss-parent/16/jboss-parent-16.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/jboss-parent/16/jboss-parent-16.pom (32 kB at 350 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-common/11.0.0.Final/jboss-metadata-common-11.0.0.Final.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-common/11.0.0.Final/jboss-metadata-common-11.0.0.Final.pom (4.0 kB at 24 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/graalvm/nativeimage/svm/19.3.1/svm-19.3.1.pom
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/graalvm/nativeimage/svm/19.3.1/svm-19.3.1.pom (2.7 kB at 29 kB/s)
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/jakarta/servlet/jakarta.servlet-api/4.0.3/jakarta.servlet-api-4.0.3.jar
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-common/11.0.0.Final/jboss-metadata-common-11.0.0.Final.jar
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-web/11.0.0.Final/jboss-metadata-web-11.0.0.Final.jar
Downloading from get-all-from-here: https://repo.maven.apache.org/maven2/org/graalvm/nativeimage/svm/19.3.1/svm-19.3.1.jar
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-common/11.0.0.Final/jboss-metadata-common-11.0.0.Final.jar (475 kB at 564 kB/s)
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/jakarta/servlet/jakarta.servlet-api/4.0.3/jakarta.servlet-api-4.0.3.jar (83 kB at 94 kB/s)
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/jboss/metadata/jboss-metadata-web/11.0.0.Final/jboss-metadata-web-11.0.0.Final.jar (468 kB at 396 kB/s)
Downloaded from get-all-from-here: https://repo.maven.apache.org/maven2/org/graalvm/nativeimage/svm/19.3.1/svm-19.3.1.jar (10 MB at 4.9 MB/s)
2020-04-28 22:12:25,728 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 1.334s. Listening on: http://0.0.0.0:8081
2020-04-28 22:12:25,729 INFO [io.quarkus] (main) Profile test activated.
2020-04-28 22:12:25,729 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.524 s - in org.acme.ExampleResourceTest
BTW, I'm not removing my default repo, I added
<localRepository>${user.home}/.m2/tmp-repo</localRepository>
to your settings.xml. I only copy io/quarkus/** artifacts in there. The rest is downloaded by the Maven build and Quarkus tests.
What is git log reporting as the last commit on the branch of Quarkus you tested?
@aloubyansky I need to apologize to you. I cloned your repo, but failed to switch to the appropriate branch. 😊
You will be happy to know that you were correct. The proposed PR resolves this issue.
Thank you so much for this, and I'm sorry for any time I took in you re-testing due to my mistake.
Good to know that there are others using Quarkus in combination with ${revision}! 😁
No problem. With this amount of details and the quality reproducer, verifying it was really easy. So thanks for all that and confirming it's worked for you.
Just wanted to mention that I am also affected by this problem. I suppose the PR will also fix it for me/my setup.
Offtopic: @jeffhubLR & @bpechiney in case you also use flatten-maven-plugin, this issue _might_ be of interest for you: "Sporadic dependency errors when building in parallel (mvn -T ...)"
Just wanted to bump it as it is also affecting my setup. I see the open PR. Thank you for the fix.
Most helpful comment
Good to know that there are others using Quarkus in combination with
${revision}! 😁