Search code examples
quarkus

Error during the build process with Quarkus: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for null


Someone, could you help me?

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!


Solution

  • I'd like to credit Falko Modler and Quarkus team for the help!

    Solution details: https://github.com/quarkusio/quarkus/issues/11433

    In summary, I've followed Falko's instruction that was to add the following configuration into the maven-surefire-plugin system properties:

    <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
            <systemPropertyVariables>
                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                <maven.home>${maven.home}</maven.home>
                <maven.settings>${session.request.userSettingsFile.path}</maven.settings>
            </systemPropertyVariables>
        </configuration>
    </plugin>
    

    And then it worked propertly!