Closed Boertie closed 4 years ago
cc @aloubyansky
@Boertie did you find a workaround for this issue? Currently experiencing the same problem!
I believe a possible workaround would be to build the project with -DskipTests
first to make sure the local maven repo contains everything needed and then work as usual.
@aloubyansky unfortunately the problem occurs on the test
job of a CI pipeline. My goal is exactly to be able to run the tests :)
Ok, sure, that's pretty unfortunate. However, if we are talking about a workaround here, could the CI be configured to resolve all the project deps first (e.g. with dependency:resolve
) and then run the tests?
Tried it, but the error persists unfortunately.
@aloubyansky would setting the property quarkus-bootstrap-offline
as explained here help after dependency resolution? Something like:
mvn dependency:resolve
mvn -Dquarkus-bootstrap-offline=true test
Oh, I don't think these properties are still supported in master. We should remove those docs.
Anyway, maven's -o
should be picked up by the test resolver.
The dependencies that it fails to resolve, are they only test deps, not compile/runtime deps?
What is the version for master
? I am running quarkus 1.2.0
currently.
The dependencies it fails to resolve are compile/runtime dependencies from a private repository (GitLab integrated repository). It looks like Quarkus it's trying to resolve the dependencies from central (and it's not published there, of course).
If I tell Quarkus to go offline for tests (the system property quarkus-bootstrap-offline
seems to work for me), then it complains that it has not downloaded io.quarkus:quarkus-bom:pom:1.2.0.Final
.
Master is 1.3.0. That's interesting. Because to be able to resolve the deps, it must resolve the BOM first.
As an experiment, could you try mvn compile -DskipTests
and then mvn -Dquarkus-bootstrap-offline=true test
?
Unfortunately nothing changes:
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [**.****.****.****.materials.controller.TestMaterialSelectionController]: Failed to create the boostrap class loader
Caused by: java.lang.IllegalStateException: Failed to create the boostrap class loader
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the deployment classloader for **.****.****.****:material-rules-engine::jar:0.1.0
Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to read descriptor of **.****.****.****:material-rules-engine:jar:0.1.0
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for **.****.****.****:material-rules-engine:jar:0.1.0
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact io.quarkus:quarkus-bom:pom:1.2.1.Final has not been downloaded from it before.
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact io.quarkus:quarkus-bom:pom:1.2.1.Final has not been downloaded from it before.
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact io.quarkus:quarkus-bom:pom:1.2.1.Final has not been downloaded from it before.
Caused by: org.eclipse.aether.transfer.RepositoryOfflineException: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode
The commands I am running:
- mvn -s .m2/settings.xml -DincludeScope=runtime dependency:resolve'
- mvn -s .m2/settings.xml compile -DskipTests'
- mvn -s .m2/settings.xml -Dquarkus-bootstrap-offline=true test'
The definition of the private repository is in the local .m2/settings.xml
passed to the commands. I am executing all commands in a maven:3-jdk-11
docker container.
I also tried to bump Quarkus to 1.2.1.Final
, but nothing changed.
Let's clarify the setup. The original description mentions both repositories
and distributionManagement
configs and says
It seems like that the repos added to the distribution management in the pom.xml aren't taken into account during the tests.
distributionManagement
config is supposed to be used when deploying artifacts, right? Which shouldn't be related to the tests. Or am I missing something @Boertie?
@simonedavico could you please describe your setup? As I imagine, you have an active by default profile in your settings.xml
that contains your private repos?
I have a settings.xml
where I specify the private repository from which the dependency should be retrieved (no publishing, so I'm also quite sure distributionManagement
is unrelated).
The thing I see in common between my setup and @Boertie's is that we both specify a custom settings file by calling mvn -s settings.xml
.
Thanks. And the repo is in an active profile, correct?
Is it active by default or what triggers its activation?
There is no active profile set explicitly, nor I defined any profile. This is my settings.xml
:
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pluginGroups>
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>********</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
Ok, that's the clue and what's also common with the original description. Thanks.
While I'm trying to set up the env to be able to reproduce the issue, could you please try adding the following deps to your apps and run the CI?
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>test</scope>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<scope>test</scope>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<scope>test</scope>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings-builder</artifactId>
<scope>test</scope>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId>
<scope>test</scope>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
<scope>test</scope>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-wagon</artifactId>
<version>1.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<version>3.3.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>3.3.4</version>
<scope>test</scope>
</dependency>
This is basically upgrading the Maven resolver and the wagon stuff the bootstrap is using during the tests.
Tried, but I still have the same error:
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [**.****.*****.*****.materials.controller.TestMaterialSelectionController]: Failed to create the boostrap class loader
Caused by: java.lang.IllegalStateException: Failed to create the boostrap class loader
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the deployment classloader for **.****.*****.*****:material-rules-engine::jar:0.1.0
Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to resolve dependencies for **.****.*****.*****:material-rules-engine:jar:0.1.0
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact **.****.*****.*****:droolsknowledge:jar:1.0.5-RC.122 in central (https://repo.maven.apache.org/maven2)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact **.****.*****.*****:droolsknowledge:jar:1.0.5-RC.122 in central (https://repo.maven.apache.org/maven2)
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact **.****.*****.*****:droolsknowledge:jar:1.0.5-RC.122 in central (https://repo.maven.apache.org/maven2)
The command the CI runs is mvn --batch-mode -s .m2/settings.xml test
.
Thanks @simonedavico
Unfortunately, I haven't been able to reproduce it yet. Here is how I tried to do that.
org.acme.quarkus.sample:my-lib:1.0-SNAPSHOT
to the Nexus repo<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>nexus-snapshots</id>
<name>nexus-snapshot</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</repository>
</repositories>
and
<dependency>
<groupId>org.acme.quarkus.sample</groupId>
<artifactId>my-lib</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
settings.xml
to the Quarkus app project dir and added
<server>
<id>nexus-snapshots</id>
<configuration>
<httpHeaders>
<property>
<name>auth-user</name>
<value>admin</value>
</property>
</httpHeaders>
</configuration>
</server>
./mvnw -s settings.xml clean test
(making sure my local repo does not contain my-lib
artifact)I can see my-lib
being downloaded from Nexus and the tests pass. If I change the value of auth-user
to a username that does not exist, the resolution will fail. Wondering what I'm missing.
If you have other suggestions on how I can reproduce it, please advise.
It is failing to resolve a runtime or test dependency, correct? I guess, you are not building your own Quarkus extension and it's failing to resolve a deployment dependency. I am actually going to try that, because what I'm seeing is my-lib
is being resolved by the Maven process and stored in my local repo. Then the tests pick it up from there. So the bootstrap resolver does not really need to download it.
I was able to reproduce it by creating my own Quarkus extension and deploying it to Nexus. That way, its runtime artifact is resolved by the original Maven process and is cached in my local repo. But its deployment artifact has to be resolved by the Quarkus bootstrap resolver during the tests. And it indeed failed. However, there was a bug that I fixed yesterday and it also fixes the use-case that I described. It's a part of 1.3.0.CR2 release which is now available in central. @simonedavico is there a chance you can try it? Make sure you use quarkus-bom
instead of quarkus-universe-bom
in your app. quarkus-universe-bom
hasn't been released yet.
Sure I can :) it should be enough to bump my quarkus.platform.version
to 1.3.0.CR2
, correct?
And <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
. Also <quarkus-plugin.version>1.3.0.CR2</quarkus-plugin.version>
, just in case.
Unless you are using Camel extensions...
Unless you are using Camel extensions...
Nope :) I'll test ASAP and get back to you!
Sorry for not giving any feedback to you @aloubyansky, I'll try to get the test done within today!
Hi, not sure this is related. I have the following error when I built through Jenkins pipelines and pointing to Nexus3. But the same build process works flawlessly when I run in command prompt and pointing to the same Nexus3 repo.
[ERROR] Non-resolvable import POM: Could not transfer artifact io.quarkus:quarkus-bom:pom:1.2.0.Final from/to Nexus (http://127.0.0.1:9000/repository/maven-all-public/): Transfer failed for http://127.0.0.1:9000/repository/maven-all-public/io/quarkus/quarkus-bom/1.2.0.Final/quarkus-bom-1.2.0.Final.pom @ line 38, column 25: Connect to 127.0.0.1:9000 [/127.0.0.1] failed: Connection refused (Connection refused) -> [Help 2]
@aloubyansky sorry for the late reply. I bumped
<quarkus-plugin.version>1.3.0.CR2</quarkus-plugin.version>
<quarkus.platform.version>1.3.0.CR2</quarkus.platform.version>
and tried again, but the error is still there:
org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact .. in central
Hi, I guess, I bumped into similar issue. I am using quarkus 1.2.0.Final. The maven build is fine on my local PC. However, same code built in Jenkins server lead to error in test instantiation, because custom artifact is looked up in root maven repo which doesnt exist of course . Unfortunately, I don't have direct access to Jenkins server, so I can just share the error message.
I tried all suggestion on this page without success (adding some test dependencies, mvn dependency:resolve -> mvn -Dquarkus-bootstrap-offline=true test)
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 42.268 s <<< FAILURE! - in ZZZZ [ERROR] ZZZZ Time elapsed: 0.015 s <<< ERROR! org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [com.ZZZZTest]: Failed to create the boostrap class loader Caused by: java.lang.IllegalStateException: Failed to create the boostrap class loader Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the deployment classloader for MY_GROUP_ID:MY_ARTEFACT_ID::jar:0.0.1-beta.2+build.54 Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to resolve dependencies for MY_GROUP_ID:MY_ARTEFACT_ID:0.0.1-beta.2+build.54 Caused by: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: MY_GROUP_ID:MY_ARTEFACT_ID_2:jar:20200324-142426, MY_GROUP_ID:MY_ARTEFACT_ID_3:jar:5.5.2, com.jayway.jsonpath:json-path:jar:2.4.0: Could not find artifact MY_GROUP_ID:MY_ARTEFACT_ID_2:jar:20200324-142426 in central (https://repo.maven.apache.org/maven2)
I tried to use 1.3.1.Final version, but then a new error message appeared during test execution (in quarkus init):
... Time elapsed: 0.013 s <<< ERROR! java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException Caused by: java.lang.reflect.InvocationTargetException Caused by: java.lang.SecurityException: Prohibited package name: java.util.concurrent
I updated quarkus junit5 integration in order to get stack trace. It doesn't help me to fix the issue, but maybe you will have an idea:
I attached customized QuarkusTestExtension.java (quarkus 1.2.1.Final)
@simonedavico could you please give 1.4.0.CR1
a try?
I'm seeing similar problems with 1.4.0.CR1
. My company proxies our dependency requests through an artifactory, yet many of the Quarkus dependencies cannot be retrieved:
java.lang.RuntimeException: MY_GROUP_ID_2.bootstrap.BootstrapException: Failed to create the application model for MY_GROUP_ID:MY_ARTIFACT_ID_1::jar:0.0.0-SNAPSHOT
Caused by: MY_GROUP_ID_2.bootstrap.BootstrapException: Failed to create the application model for MY_GROUP_ID:MY_ARTIFACT_ID_1::jar:0.0.0-SNAPSHOT
Caused by: MY_GROUP_ID_2.bootstrap.resolver.AppModelResolverException: Failed to resolve dependencies for MY_GROUP_ID:MY_ARTIFACT_ID_1:jar:0.0.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: MY_GROUP_ID_2:MY_ARTIFACT_ID_2:jar:1.1.0.Final, MY_GROUP_ID_2:MY_ARTIFACT_ID_3:jar:1.1.0.Final: Could not find artifact MY_GROUP_ID_2:MY_ARTIFACT_ID_2:jar:1.1.0.Final in central (https://repo.maven.apache.org/maven2)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: MY_GROUP_ID_2:MY_ARTIFACT_ID_2:jar:1.1.0.Final, MY_GROUP_ID_2:MY_ARTIFACT_ID_3:jar:1.1.0.Final: Could not find artifact MY_GROUP_ID_2:MY_ARTIFACT_ID_2:jar:1.1.0.Final in central (https://repo.maven.apache.org/maven2)
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact MY_GROUP_ID_2:MY_ARTIFACT_ID_2:jar:1.1.0.Final in central (https://repo.maven.apache.org/maven2)
I've fixed a couple of related issues that I could actually reproduce. They are https://github.com/quarkusio/quarkus/issues/9279 https://github.com/quarkusio/quarkus/issues/9255 I believe this issue should be fixed now. Please give the upcoming 1.5.0.CR1 (planned to be released on May 19) a try. If it does not fix it in your environment, please open a new issue with a very detailed description. Thanks everyone.
@aloubyansky I wanted to give 1.5.0.Final
a try but it looks like it is not yet compatible with Kogito, correct? I also tried to scaffold a new application by specifying quarkus:quarkus-maven-plugin:1.5.0.Final:create
(and kogito
plugin), but the project was created with 1.4.2.Final
.
I have to assume there is no support for 1.5.0 on kogito side?
@simonedavico thanks for checking. What we've released so far is Quarkus core with quarkus-bom
. Kogito however has moved out of the Quarkus repo (as a consequence from quarkus-bom
) and integrated into quarkus-universe-bom
(Quarkus platform) which is planned to be released next Tuesday.
The create
command is looking for the latest available platform which is 1.4.2.Final at the moment.
Good to know, I will wait for next week to test and post the result here :)
In case anyone still encounters this issue: make sure that your MAVEN_HOME variable is set. I had the same issue (also on 1.5.0.Final) and it was fixed after setting the variable.
Just bumped into this issue, i am on 2.1.4.Final and still have the problem ....
@deodorel thanks for letting us know. Please open a new issue and provide as many details about the environment and configuration which is affected by the issues.
Ok thanks for your answer. I will prepare that.
Thanks @deodorel Also, please, mention me in the issue you will create.
20444 created. Thanks!
Describe the bug When the project is being build it finds all necessary dependencies to build the project. However, when it wants to run it's tests it tries to find the dependencies on maven central.
The logs show the following during the tests: Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to resolve dependencies for nl..service:****:jar:1.0.9-SNAPSHOT Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact nl..**:****:jar:1.0.8 in central (https://repo.maven.apache.org/maven2) Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact nl..**:****:jar:1.0.8 in central (https://repo.maven.apache.org/maven2) Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact nl..**:****:jar:1.0.8 in central
During the build: [INFO] Downloading from gitlab-maven: https://gitlab.*****..*****./api/v4/groups/.*****./-/packages/maven/.*****./.*****./.*****./.*****.-.*****.-.*****./1.0.8/.*****.-.*****.-.*****.-1.0.8.pom [INFO] Downloaded from gitlab-maven: https://gitlab..*****...*****./api/v4/groups/.*****./-/packages/maven/.*****./.*****./.*****./.*****.-.*****.-.*****./1.0.8/.*****.-.*****.-.*****.-1.0.8.pom (4.6 kB at 29 kB/s) [INFO] Downloaded from gitlab-maven: https://gitlab.*****.*****/api/v4/groups/*****/-/packages/maven/*****/*****/*****/*****-*****-*****/1.0.8/*****-*****-*****-1.0.8.jar (25 kB at 82 kB/s)
The settings.xml looks like the following:
The pom file has the following dependency management files:
It seems like that the repos added to the distribution management in the pom.xml aren't taken into account during the tests.
Expected behavior The dependencies should be downloaded from the private Maven repository and the repos added to the distributed management should be taken into account.
Actual behavior It seems like the repos aren't taken into account.
To Reproduce Steps to reproduce the behavior: run
Configuration
Environment (please complete the following information):
uname -a
orver
: Linux runner-vzxynpr1-project-1-concurrent-0px5nz 4.14.138+ #1 SMP Mon Aug 26 22:41:20 PDT 2019 x86_64 GNU/Linuxjava -version
: openjdk version "11.0.4" 2019-07-16 OpenJDK Runtime Environment 18.9 (build 11.0.4+11) OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11, mixed mode)