Resolving Maven conflict: jBoss AS 7 duplicate Antlr jar exclussion from POM for JUnit runner

StackOverflow https://stackoverflow.com/questions/22479741

Вопрос

I am running into an issue building for JUnit when I exclude Antlr from the hibernate-entitymanager dependency declaration in the POM file.

I had to exclude Antlr since it seems like JBoss AS 7 is introducing its own copy of the jar file. After I add the exclusion I am able to build and deploy to JBoss just fine, but I am not able to run the unit tests unless I manually remove the exclusion.

Below is the relevant section of the POM file.

What is the best way to solve this issue or tell Maven to not exclude Antlr when running in JUnit?

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.6.0.Final</version>
    <scope>compile</scope>
    <!-- Exclude antlr since it conflicts with Jboss AS7 
    <exclusions>
     <exclusion>
       <groupId>antlr</groupId>
       <artifactId>antlr</artifactId>
       </exclusion>
    </exclusions>  -->
</dependency>
Это было полезно?

Решение

Thanks to ctomc's suggestion, I used this solution which worked for me. Thanks again!

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.6.0.Final</version>
    <scope>compile</scope>
    <!-- Exclude antlr since it conflicts with Jboss AS7   -->
    <exclusions>
        <exclusion>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>antlr</groupId>
    <artifactId>antlr</artifactId>
    <version>2.7.7</version>
    <scope>provided</scope>
</dependency>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top