I have project B inherit from project A. In Project A, I have to copy jar file downloaded from Maven into lib folder. Project A's pom file :
<groupId>com.penguin.com.projecta</groupId>
<artifactId>penguin-common--pom</artifactId>
<packaging>pom</packaging>
<version>${com.penguin.common.projecta}</version>
<name>Penguin COMMON POM</name>
<modules>
<module>projectb</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-jars</id>
<phase>process-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<overWriteIfNewer>true</overWriteIfNewer>
<artifactItems>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.1</version>
<type>jar</type>
<destFileName>ant-contrib.jar</destFileName>
<outputDirectory>lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
When i build, maven copied jar file to lib folder but it also create lib folder in Project B and copy jar file defined in Project A's pom file into it. Now i want to exclude it in project B. I tried with this script below but it doesn't work.
<dependencies>
<dependency>
<groupId>com.penguin.com.projecta</groupId>
<artifactId>penguin-common--pom</artifactId>
<version>${com.penguin.common.projecta}</version>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
I refer this link: Is there anyway to exclude artifacts inherited from a parent POM?. But it doesn't help me also.