I have created a maven profile with maven-dependency-plugin inside it.
Below is my plugin
<profile>
<id>copy-dep</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-external</id>
<phase>none</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<excludeGroupIds>group ids that I need to exclude</excludeGroupIds>
<excludeArtifactIds>artifact ids that I need to exclude</excludeArtifactIds>
<includeArtifactIds>artifact ids that I need to include</includeArtifactIds>
<includeGroupIds>group id that I need to include</includeGroupIds>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
I am using the below command to execute
mvn dependency:copy-dependencies -DoutputDirectory=libs -Pcopy-dep
But when I execute the command it looks for all the dependencies defined in pom and copies them as well.
I have tried to put unwanted dependencies inside exclude tag but it didn't work then I also tried by removing exclude tag and keeping the required dependencies but also didn't worked.
In my pom, I am using maven assembly plugin to separate out the required dependencies, which I don't want to get copied with the created profile.
Any idea where I am going wrong here? is there a better way to achieve the same.