quarkus
quarkus copied to clipboard
Error during the Maven build process with Quarkus: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for null
I'm trying to use Quarkus in a project of the company that I'm working on.
That's my scenario:
The company that I'm working on has an on-premises environment with a CI server and an Artifactory that provides the all required artifacts. The CI has no grant access to reach out to the internet then the Artifactory server is responsible for bringing all external artifacts. We've got a lot of spring-boot applications that are built with the same CI... so I'm assuming that both, our CI and Artifactory, they're configured properly.
Here's my issue:
Our CI server has executed "mvn package" command and it's showing this following error, but this error is happening during the test phase:
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Running myproject.resources.HelloResourceTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 127.996 s <<< FAILURE! - in myproject.resources.HelloResourceTest
[ERROR] myproject.resources.HelloResourceTest.testHelloEndpoint Time elapsed: 0.016 s <<< ERROR!
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] HelloResourceTest.testHelloEndpoint » Runtime io.quarkus.bootstrap.BootstrapEx...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] myproject.............. ............................ FAILURE [02:29 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:41 min
[INFO] Finished at: 2020-08-17T18:38:56Z
[INFO] ------------------------------------------------------------------------
But there's no special thing happening the target class of the test:
package myproject.resources;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class HelloResourceTest {
@Test
public void testHelloEndpoint() {
given()
.when().get("/hello")
.then()
.statusCode(200)
.body(is("Ops!"));
}
}
Here's the implementation of the target Resource:
package myproject.resources;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.logging.Logger;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
public class HelloResource {
private static final Logger LOG = Logger.getLogger(HelloResource.class);
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Ops!";
}
}
Then I've executed 'mvn package -e -X' and I caught this exception message:
java.lang.RuntimeException
java.lang.RuntimeException: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for null
Cased by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for null
Caused by: java.lang.RuntimeException: Failed to create application model resolver for /home/dearrudam/myproject
Caused by: io.quarkus.bootstrap.resolver.maven.BootstrapMavenException: Failed to read artifact descriptor for myproject:myproject:pom:1.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for myproject:myproject:pom:1.0-SNAPSHOT
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact io.quarkus:quarkus-universe-bom:pom:1.7.0.Final from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/quarkus/quarkus-universe-bom/1.7.0.Final/quarkus-universe-bom-1.7.0.Final.pom
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact io.quarkus:quarkus-universe-bom:pom:1.7.0.Final from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/quarkus/quarkus-universe-bom/1.7.0.Final/quarkus-universe-bom-1.7.0.Final.pom
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact io.quarkus:quarkus-universe-bom:pom:1.7.0.Final from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/quarkus/quarkus-universe-bom/1.7.0.Final/quarkus-universe-bom-1.7.0.Final.pom
Caused by: org.apache.maven.wagon.TransferFailedException: Transfer failed for https://repo.maven.apache.org/maven2/io/quarkus/quarkus-universe-bom/1.7.0.Final/quarkus-universe-bom-1.7.0.Final.pom
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/199.232.64.215] failed: Connection timed out (Connection timed out)
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
Why it's trying to reach out to the repo.maven.apache.org instead of my local Artifactory?
Thanks!
/cc @quarkusio/devtools
@aloubyansky any thoughts?
We need to know precisely how the proxy is configured.
We had some issues at some point with part of the code not honoring the proxy configuration but I thought we were done with that. Apparently, there's still some issue lurking.
Here are some pieces of my settings.xml that the CI server is using:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
...snipped
...
<mirrors>
...
...snipped
...
<mirror>
<id>artifactory</id>
<mirrorOf>*</mirrorOf>
<url>https://artifactory.myrepo.net/artifactory/libs-release</url>
<name>Artifactory</name>
</mirror>
...
...snipped
...
</mirrors>
...
...snipped
...
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory.myrepo.net/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory.myrepo.net/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>https://artifactory.myrepo.net/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-release</name>
<url>https://artifactory.myrepo.net/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
...
...snipped
...
</settings>
IMHO I think that it's a problem if the code is trying to download something directly from the internet instead of to use the maven settings, I'm mean, it will be a Quarkus adoption issue for companies with internet restrictions.
IMHO I think that it's a problem if the code is trying to download something directly from the internet instead of to use the maven settings
Yeah, sure, it's definitely a bug if it tries to download things and bypasses the proxy.
/cc @aloubyansky
@dearrudam How does you maven-surefire-plugin
config look like? Where is the settings.xml
located?
Here's the maven-surefire-plugin's configuration in the pom.xml:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<argLine>
--illegal-access=permit
</argLine>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
The CI provides the settings.xml passing by argument "-s" in the maven command:
mvn -s /somedir/settings.xml clean package
The CI provides the settings.xml passing by argument "-s" in the maven command:
Ok, that might be a problem but @aloubyansky is a better candidate to check this.
Apart from that I realized that you do not actually use a proxy
but a mirror
!
Apart from that I realized that you do not actually use a proxy but a mirror!
Yeah, there's no proxy configuration for the CI server... the server cannot access the internet directly for security reason then we need to use an Artifactory in order to retrieve the project dependencies. This configuration has been working properly for other projects of the company(most of them use the Spring Boot framework).
@dearrudam
The CI provides the settings.xml passing by argument "-s" in the maven command:
mvn -s /somedir/settings.xml clean package
Just to make sure, since I found a problem while debugging: You are passing an absolute path via -s
? Not something like -s ~/settings.xml
?
Can you try adding <maven.settings>${session.request.userSettingsFile.path}</maven.settings>
to surefire system properties?
But be warned that this might cause problems in IntelliJ IDEA.
@dearrudam
The CI provides the settings.xml passing by argument "-s" in the maven command:
mvn -s /somedir/settings.xml clean package
Just to make sure, since I found a problem while debugging: You are passing an absolute path via
-s
? Not something like-s ~/settings.xml
?Can you try adding
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
to surefire system properties? But be warned that this might cause problems in IntelliJ IDEA.
@famod, I've just followed your instruction:
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
And it worked properly!
Thank you very much, everyone!
PS: I'd like to learn more about Quarkus and contribute to this awesome project also!
Best regards!
I wish you all the best!
Max
This still looks like something we should support OOTB.
Just to clarify @dearrudam, those repository configs you posted above, are they configured in a profile?
Just to clarify @dearrudam, those repository configs you posted above, are they configured in a profile?
No, those repository configs are not configured in a profile. They're under the "settings" root tag.
Btw, why are you redefining central
? The mirror
entry should suffice, no?
Btw, why are you redefining
central
? Themirror
entry should suffice, no?
Well, I'm not responsible for this settings :) I think that the reason why is to make sure that all request will be redirected to the target Artifactory server.
Just to clarify @dearrudam, those repository configs you posted above, are they configured in a profile?
No, those repository configs are not configured in a profile. They're under the "settings" root tag.
That's interesting because it's not supported, afaics. Repositories in the settings can only be configured in a profile.
Good catch! So maybe those repos are ignored altogether?
mirrors
on the other hand are allowed directly under settings
(and only there).
Just to clarify @dearrudam, those repository configs you posted above, are they configured in a profile?
No, those repository configs are not configured in a profile. They're under the "settings" root tag.
That's interesting because it's not supported, afaics. Repositories in the settings can only be configured in a profile.
Yeah... you're right! I've just asked the responsible one to provide me the complete setting.xml file instead of the snipped piece with repository configs then I've just realized that those configs ones are under a default profile that such one is activated already.
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mirrors>
<mirror>
<id>artifactory</id>
<mirrorOf>*</mirrorOf>
<url>https://artifactory.myrepo.net/artifactory/libs-release</url>
<name>Artifactory</name>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory.myrepo.net/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory.myrepo.net/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>https://artifactory.myrepo.net/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-release</name>
<url>https://artifactory.myrepo.net/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory.myrepo.net</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory.myrepo.net</activeProfile>
</activeProfiles>
</settings>
Thanks for confirming @dearrudam Just FYI, I tried to reproduce it quickly yesterday with mirror * and nexus but in nexus I created a group that included also maven central and that worked, i.e. i couldn't reproduce it. I guess what I need to do is to remove the central repo from the group and redefine it the way it is done in your config. I'll try that later today or this week.
@famod we need to add <maven.settings>${session.request.userSettingsFile.path}</maven.settings>
to our surefire properties. Clearly the settings file isn't found.
And as in the other issue, I think we should add <maven.repo.local>${session.request.localRepositoryPath.path}</maven.repo.local>
and probably others.
Do you want to add them or shall I?
@aloubyansky you can do it if you find some time. Too bad we need such a verbose solution. Are you sure this works in IntelliJ IDEA? And I guess we'd need some documentation for Eclipse as well?
Yes, not elegant. But I don't see how to resolve a relative path to the settings, given that we can't get hold of the dir from which mvn was launched. Unless it's the project dir or -f was also provided and its value is also a relative path.
IDEs are different in that regard, I think. I think it's mostly about launching builds outside of project dirs. I may be wrong though.
IntelliJ IDEA automatically passes all systemPropertyVariables
to the test execution.
We should make sure not to break things in that regard (e.g. make sure IDEA can resolve the property).
@dearrudam could you please check once again your CI and confirm whether the value of -s
is an absolute or a relative path? Thanks a lot.
@dearrudam could you please check once again your CI and confirm whether the value of
-s
is an absolute or a relative path? Thanks a lot.
@aloubyansky, sorry my delayed answer, the value of -s
is an absolute path.
Thanks @dearrudam. That is really puzzling. I don't understand how it could fail to resolve an absolute path. Does it contain whitespaces?
The only other possibility to fail here is if MAVEN_CMD_LINE_ARGS
env var isn't available. Which is set in mvn
script.
Thanks @dearrudam. That is really puzzling. I don't understand how it could fail to resolve an absolute path. Does it contain whitespaces? The only other possibility to fail here is if
MAVEN_CMD_LINE_ARGS
env var isn't available. Which is set inmvn
script.
Hi @aloubyansky, what I know is that the CI server is running the build processing with "maven:3.6.3-jdk-11" docker image... it's needed to check it out.