I am trying to do two things here :
1. Copy the dependencies to two different folders :
a. package1 - contains my other project dependencies
b. package2 - contains third party jar dependencies
2. Write all the jars in both package1 and package2 to another file 'dependencyJars.txt'
The dependencyJars.txt must contain all the jars in package1 and package2 as well.
I am unable to achieve that.
The second build-classpath overwrites the dependencies written by first build-classpath.
So at the end, only package2 dependencies are available in dependencyJars.txt.
Is there any way to achieve the above thing, i.e, the first execution writes its dependencies to dependencyJars.txt, and then the second execution appends its
dependencies in the file dependencyJars.txt?
My POM content is as follows :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>build-package1-dependencies</id>
<phase>package</phase>
<goals>
<goal>build-classpath</goal>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<appendOutput>true</appendOutput>
<prefix>package1/</prefix>
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
<excludeGroupIds>com.test.package2</excludeGroupIds>
<outputDirectory>${project.build.directory}/package1-jars/</outputDirectory>
<outputFile>D:/new2/dependencyJars.txt</outputFile>
<overWriteIfNewer>true</overWriteIfNewer>
<regenerateFile>false</regenerateFile>
</configuration>
</execution>
<execution>
<id>build-package2-dependencies</id>
<phase>package</phase>
<goals>
<goal>build-classpath</goal>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<appendOutput>true</appendOutput>
<prefix>package2/</prefix>
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
<excludeGroupIds>com.test.package1</includeGroupIds>
<outputDirectory>${project.build.directory}/package2-jars/</outputDirectory>
<outputFile>D:/new2/dependencyJars.txt</outputFile>
<overWriteIfNewer>true</overWriteIfNewer>
<regenerateFile>false</regenerateFile>
</configuration>
</execution>
</executions>