weld-junit5 with weld 3

1.2k views Asked by At

Recently we upgraded Weld to 3.0.3.Final (with is the one in Wildfly 12). Now weld-junit5 1.3.1.Final (the most recent version) throws an exception

java.lang.NoSuchMethodError: javax.enterprise.inject.spi.AfterBeanDiscovery.addBean()Ljavax/enterprise/inject/spi/configurator/BeanConfigurator;

We added weld-se-core to the dependency management:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.weld.se</groupId>
                <artifactId>weld-se-core</artifactId>
                <version>3.0.3.Final</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

This overrules the default Version of weld-se-core 2.4.8.Final, which is defined in weld-junit5. But it seems that weld-junit5 depends on the structure of weld 2.x

weld-junit5 states on its github page that weld 3 is supported but there is no description how to use it. I have found this in the POM of weld-junit5:

<profile>
         <id>weld3</id>
         <activation>
            <activeByDefault>false</activeByDefault>
            <property>
               <name>env.WELD_JUNIT_PROFILE</name>
               <value>weld3</value>
            </property>
         </activation>
         <dependencies>
            <dependency>
               <groupId>org.jboss.weld.module</groupId>
               <artifactId>weld-ejb</artifactId>
               <version>${version.weld}</version>
               <scope>test</scope>
            </dependency>
         </dependencies>
      </profile>

But I did not get this profile activated.

How can this be solved?

1

There are 1 answers

2
Marc von Renteln On BEST ANSWER

With weld-se-shaded instead of weld-se-core it works.