javaee-samples / javaee7-samples

Java EE 7 Samples
https://travis-ci.org/javaee-samples/javaee7-samples
Other
2.51k stars 1.66k forks source link

Fix some failures using wildfly-swarm profile #423

Closed juangon closed 6 years ago

juangon commented 6 years ago

Hi @arjantijms. Here comes more fixes for Wildfly Swarm that improves our coverage.

1-Upgrade arquillian and wildfly swarm version. In latest version there are two issues fixed that affects wildfly swarm: https://issues.jboss.org/browse/ARQ-2107 and https://issues.jboss.org/browse/ARQ-2109.

2- Exclude payara container to avoid duplicated arquillian container error. This error is reproducible since some of the latest commits changing the payara container. Weirdly, this dependency comes in when using test-utils.

Thanks!

arjantijms commented 6 years ago

Thx again!

I wonder though, the test-utils project should probably not have the fish.payara.arquillian dependency to begin with. Looking at its pom.xml, it doesn't have that dependency directly, and in the main pom it can only come it when the profile is defaulted or set to payara.

juangon commented 6 years ago

Yes, that's weird! But I couldn't fix it other way. Dependency tree looks like this for ejb and wildfly-swarm profile for example:

[INFO] org.javaee7:ejb-stateless:war:1.0-SNAPSHOT [INFO] +- org.javaee7:test-utils:jar:1.0-SNAPSHOT:compile [INFO] | +- org.jboss.arquillian.container:arquillian-container-test-api:jar:1.1.11.Final:compile [INFO] | | - org.jboss.shrinkwrap:shrinkwrap-api:jar:1.2.3:compile [INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:jar:2.2.0:compile [INFO] | | - org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api:jar:2.2.0:compile [INFO] | - fish.payara.arquillian:arquillian-payara-server-4-managed:jar:1.0.Beta2:compile

Weird...

arjantijms commented 6 years ago

Did you use any of the profile flags when looking for that dependency graph? It looks like to be just the default profile, which is deactivated when using -P[something else].

At any length, could you try replacing the test-utils pom with the following content to see if that works?

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>

    <groupId>org.javaee7</groupId>
    <artifactId>test-utils</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Java EE 7 Sample: javaee7-samples - test-utils</name>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.1.11.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.container</groupId>
            <artifactId>arquillian-container-test-api</artifactId>
            <version>1.1.11.Final</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
        </dependency>
    </dependencies>

</project>
juangon commented 6 years ago

@arjantijms wow that worked! Let me redo this PR with your changes and new versions..

juangon commented 6 years ago

@arjantijms would it be ok to use a global pom.xml property? The problem I see is that, now that test-utils doesn't have parent pom.xml, if compiled alone won't work, as that property won't exist.

EDIT: I actually mean pom.xml property, not arquillian.

arjantijms commented 6 years ago

@juangon

Depending on what you exactly want to do, you may use some defaults. Still, it's probably unlikely to have to compile the test-utils on their own without going through the parent.

juangon commented 6 years ago

@arjantijms just want to unify ${arquillian.version} in parent, then use it in test-utils so everyone uses it.

So do you agree to use that approach as, as you said, it isn't very likely to use it alone?

arjantijms commented 6 years ago

I think that would be fine. Additionally, the version could always be provided externally if really needed to be compiled stand-alone via a -D option.

juangon commented 6 years ago

Made other PR here: https://github.com/javaee-samples/javaee7-samples/pull/424

Closing this one.

Thanks a lot!