Dependency conflict in JSF with Maven

0

I created a Maven project in Eclipse with JSF 2, project has been evolving well, running Tomcat 8 with no problems and that's when I started to implement the reports so I put the dependencies for Jasper according to the code below, hence tomcat does not go up, I understand that this is a conflict of my dependencies and that I need to exclude so I have already scoured the documentation and saw videos about it, but I did not succeed.

In this project I use Spring Security, Hibernate etc ...

    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>6.0.3</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports-fonts</artifactId>
        <version>6.0.0</version>
        <scope>compile</scope>
    </dependency>

I have already looked at the hierarchy of pom (which is not easy mine), here follows my complete dependencies without putting Jasper and there the project goes up without problems if someone can give a hint of how I can proceed gratefulness. >

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- Java -->
    <java.version>1.8</java.version>

    <!-- Primefaces -->
    <primefaces.version>6.0</primefaces.version>

    <!-- Hibernate / JPA -->
    <hibernate.version>4.3.10.Final</hibernate.version>

    <!-- Validator -->
    <validator.version>5.2.3.Final</validator.version>        

    <!-- Weld - Implementação do CDI -->
    <weld.version>2.3.5.Final</weld.version>

    <!-- JSF Version -->
    <javax.faces.version>2.2.10</javax.faces.version>

</properties>

<repositories>
    <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
    </repository>
</repositories>

<dependencies>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>${primefaces.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>bootstrap</artifactId>
        <version>1.0.10</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.primefaces.themes</groupId>
        <artifactId>bluesky</artifactId>
        <version>1.0.10</version>
        <scope>compile</scope>
    </dependency>

    <!-- Usado para geração de arquivos Excel -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.11</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>${javax.faces.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.weld.servlet</groupId>
        <artifactId>weld-servlet</artifactId>
        <version>${weld.version}</version>
        <scope>compile</scope>
    </dependency>

    <!-- Weld depende do Jandex -->
    <dependency>
        <groupId>org.jboss</groupId>
        <artifactId>jandex</artifactId>
        <version>2.0.2.Final</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>${validator.version}</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>
        <scope>compile</scope>
    </dependency>


    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernate.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1.0</version>
        <scope>provided</scope>
    </dependency>

    <!-- Spring Security (autenticação e autorização) -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>3.2.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.2.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.2.5.RELEASE</version>
    </dependency>

    <!-- Database dependencies -->

    <!-- PostgresSQL dependencies -->
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.3</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
            <exclusion>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901.jdbc4</version>
        <scope>provided</scope>
    </dependency>

    <!-- retrofit -->
    <dependency>
        <groupId>com.squareup.retrofit</groupId>
        <artifactId>retrofit</artifactId>
        <version>1.9.0</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <!-- SLF4J <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> 
        <version>1.7.7</version> </dependency> -->
    <!-- Commons Logging (abstrai a implementação de logging) -->
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.3</version>
        <scope>compile</scope>
    </dependency>

    <!-- Commons Lang (utilidades) -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
        <scope>compile</scope>
    </dependency>

    <!-- Log4J -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
        <scope>compile</scope>
    </dependency>


    <!-- omnifaces -->
    <dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>omnifaces</artifactId>
        <version>1.14</version>
    </dependency>

    <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>3.4</version>
        <scope>test</scope>
    </dependency>

    <!--google gson -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.6.2</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
        <scope>compile</scope>
    </dependency>


</dependencies>
    
asked by anonymous 04.02.2017 / 19:35

1 answer

1

Use the exclusions tag of Maven. If you are using Eclipse as an IDE.

For example: in the Dependency Hierarchy tab you can see all dependencies in tree format.

If any dependency appears more than once, give preference to the most current and "delete" the obsolete one.

    <dependency>
        <groupId>com.group.name</groupId>
        <artifactId>project</artifactId>
        <version>1.0.0</version>
        <exclusions>
            <exclusion>
                <groupId>com.anothergroup.name</groupId>
                <artifactId>projeto-em-conflito</artifactId>
                <version>1.0.0</version>
            </exclusion>
        </exclusions>
    </dependency>
    
06.02.2017 / 20:34