2
votes

I'm using below configuration to copy the system dependencies in maven.

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.8</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
                            <includeScope>system</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
            </plugin>

on "mvn package goal" , the strange thing is happening .

I can see all the system dependencies in "${project.build.directory}/${project.build.finalName}/WEB-INF/lib" target directory as configured in maven-dependency-plugin. But those dependencies are missing in war file.

Can someone please share the ideas ?

1
Could you provide the maven log? Maybe the copy-dependencies goal is executed after the war is packaged? - K Erlandsson
what is the type of the maven project itself? how is the dependency defined? - rmalchow
also - why would you need to do that? - rmalchow

1 Answers

1
votes

Try configuring the maven-war-plugin like this:

    <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>
        </configuration>
    </plugin>

If doesn't help, then I guess Kristoffer E is right: your war is packaged before the dependencies are copied. In that case you should change the phase from package to process-sources in the maven-dependency-plugin so it will be executed earlier.