Page 1 of 1

Maven Transitive Dependencies

PostPosted: Fri Aug 08, 2014 2:18 pm
by rinaldopjr
I've followed the step-by-step guide (http://www.docx4java.org/blog/2011/10/h ... n-central/), and also googled to see if it was a common problem, but no luck.

I created the Eclipse project, configured it as a Maven Project (I work with Maven daily), declared docx4j's dependency on pom.xml, but it's transitive dependencies are not being added to the project. Am I missing something? Aren't those dependencies declared as "compile" in docx4j project's pom?

Re: Maven Transitive Dependencies

PostPosted: Fri Aug 08, 2014 7:47 pm
by jason
You must be missing something... what does your pom contain (especially the docx4j dependency)?

It may help in Eclipse to "Maven > Update Project" or Disable Maven nature then re-enable.

Also have a look in Eclipse's error list.

Re: Maven Transitive Dependencies

PostPosted: Sat Aug 09, 2014 12:28 am
by rinaldopjr
I tried creating a new Maven project, disabling/enabling Maven nature, Maven Update Project, full clean and build, still no luck.

The only dependency that Maven is downloading is docx4j-3.1.0.jar, not the transitive ones.

Bellow is my pom.xml:

Code: Select all
<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>
    <groupId>docx4jtestproject</groupId>
    <artifactId>docx4jtestproject</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>docx4jtestproject</name>
    <description>docx4jtestproject</description>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.docx4j</groupId>
            <artifactId>docx4j</artifactId>
            <version>3.1.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

Re: Maven Transitive Dependencies

PostPosted: Sat Aug 09, 2014 8:03 am
by jason
That POM works for me.

I'm using m2e v 1.1.0.20120530-0009 (getting a bid old now!)

the .project file:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<projectDescription>
        <name>docx4jtestproject</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
                <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        <name>org.eclipse.m2e.core.maven2Builder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>org.eclipse.m2e.core.maven2Nature</nature>
        </natures>
</projectDescription>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


.classpath:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<classpath>
        <classpathentry kind="src" output="target/classes" path="src/main/java">
                <attributes>
                        <attribute name="optional" value="true"/>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="src" output="target/test-classes" path="src/test/java">
                <attributes>
                        <attribute name="optional" value="true"/>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="output" path="target/classes"/>
</classpath>
 
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


.settings/org.eclipse.m2e.core.prefs:

Code: Select all
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

Re: Maven Transitive Dependencies

PostPosted: Sun Aug 10, 2014 2:55 pm
by rinaldopjr
Just to be clear: with this POM, eclipse downloads docx4j-3.1.0.jar plus ALL transitive dependencies?

Re: Maven Transitive Dependencies

PostPosted: Tue Aug 12, 2014 1:42 pm
by jason
yes