Quarkus: Running test on 0.13.0 fails FilterBuildItem not found

Created on 8 Apr 2019  路  19Comments  路  Source: quarkusio/quarkus

Running mvnw package on git clone https://github.com/quarkusio/quarkus-quickstarts.git
fails with:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.914 s <<< FAILURE! - in org.acme.config.GreetingResourceTest
[ERROR] testHelloEndpoint  Time elapsed: 0.008 s  <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.acme.config.GreetingResourceTest]: io/quarkus/undertow/deployment/FilterBuildItem
Caused by: java.lang.NoClassDefFoundError: io/quarkus/undertow/deployment/FilterBuildItem
Caused by: java.lang.ClassNotFoundException: io.quarkus.undertow.deployment.FilterBuildItem

My other < 0.13 projects that I upgraded to 0.13.0 are failing in the same way.

kinbug

Most helpful comment

Ok, I see it. I had to start clean, not just remove io/quarkus. Thanks. Looking into it.

All 19 comments

Hmmm, it's weird, I just tried a build on a fresh git clone of the quickstarts and I can build them (and they are fully tested as part of our release process).

Could you give us more information about your environment?

Indeed.
MacOS 10.14.4
Maven 3.6.0
JDK 11.0.1 2018-10-26
I cloned into an empty directory and didn't change anything in the project.

Yes, that's what I did too. It was with JDK 8 but I just tested with JDK 11 and it works ok for me.

@cescoffier could you test on MacOS?
@diabolicallabs could you try to drop your ~/.m2/repository/io/quarkus/ and download the artifacts again? I just did it with fresh artifacts and it seems to work too.

Same exception for the quickstart tests here, also after dropping the m2.

When running tests for my own project I get the same exception, but for a different class:
java.lang.NoClassDefFoundError: io/quarkus/arc/deployment/BeanContainerListenerBuildItem

Hmm, if it's on an application, do you have the Quarkus dependencies defined as provided? If so you need to drop the scope.

None of the dependencies have an explicit scope.

@Edubits which quickstart was it? Did you also do git clone https://github.com/quarkusio/quarkus-quickstarts.git and build it? Or how would you describe the steps to reproduce? Thanks.

Steps to reproduce:

$ rm -r ~/.m2/repository/io/quarkus/
$ git clone https://github.com/quarkusio/quarkus-quickstarts.git
$ cd quarkus-quickstarts/getting-started
$ mvn clean compile test

Mvn log:
mvn-clean-compile-test.txt

Environment:
MacOS 10.14.4
Maven 3.6.0
Java 11.0.2 2019-01-15 LTS

Hum... I'm able to reproduce it.

Works if I add:

<dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-resteasy-deployment</artifactId>
        <version>${quarkus.version}</version>
</dependency>

It should not be the case.

Really? I couldn't reproduce it given the same Maven and Java versions.

Can it be a cache issue, because I now removed the dependency and it passes.

Try disabling it with -Dquarkus-classpath-cache=false

Nope...

  1. I've the issue (be sure to run from a clean repo)
  2. I add the dependency -> issue fixed
  3. I remove the dependency -> issue still fixed ?????

Cache or not cache does not change anything

I'm seeing the same behaviour as @cescoffier, except that removing the dependency restores the non-working state.

In my own application (which uses more extensions) adding the dependency causes the next class not to be found: io.quarkus.agroal.deployment.DataSourceDriverBuildItem
So I probably explicitly adding the agroal deployment as dependency will fix/workaround this.

Ok, I see it. I had to start clean, not just remove io/quarkus. Thanks. Looking into it.

Until the next release containing the fix, you can use the following settings.xml (mvn -s settings.xml <goals>) as a workaround

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <id>default-profile</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo.maven.apache.org/maven2/</url>
          <layout>default</layout>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>

Sorry for the inconvenience.

Thanks @aloubyansky, that works for now

This should be fixed now in the released 0.13.1.

Was this page helpful?
0 / 5 - 0 ratings