4

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 ?

3
  • 2
    Could you provide the maven log? Maybe the copy-dependencies goal is executed after the war is packaged? Commented May 8, 2015 at 19:30
  • what is the type of the maven project itself? how is the dependency defined? Commented May 8, 2015 at 20:18
  • also - why would you need to do that? Commented May 8, 2015 at 20:20

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I had same problem and just found that we had <packagingExcludes/> option enabled long time ago to skip just those libraries I needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.