Search code examples
javamavendependenciesaemapache-fop

AEM, Maven : duplicated package name


I want to add "fop-core" dependency.
My project was added "uber-jar" dependency already.

The uber-jar dependency has org.apache.fop.apps.FopFactory.java file.
But, doesn't have org.apache.fop.apps.FopFactoryBuilder.java file.

The fop-core dependency has both FopFactory.java and FopFactoryBuilder.java files.

Thus, my program loads FopFactory.java in "uber-jar" instead of "fop-core".

How can I resolve this duplication??

  1. Can I remove "FopFactory.java" file in "uber-jar" dependency?

OR

  1. Can I force load "FopFactory.java" file in "fop-core" dependency?

uber-jar

    <groupId>com.adobe.aem</groupId>
    <artifactId>uber-jar</artifactId>
    <classifier>apis</classifier>
</dependency>

fop-core

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>fop-core</artifactId>
    <version>2.5</version>
</dependency>

Solution

  • Echoing Oliver Gebert response, I did that a few months ago for Apache POI, in the main pom.xml, I put it as the first dependency:

        <dependencyManagement>
        <dependencies>
            <!-- Apache POI (First in order to avoid conflict with the version from the UberJar) -->
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi</artifactId>
                <version>3.11</version>
            </dependency>