Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

excluding .class file from jar maven dependency

Tags:

java

maven

I had 3 maven projects A,B,C. A is dependent on B which in-turn depends on C. A's POM has dependency for B and B's POM has dependency for C. I want to exclude a class file in C when building A.

How can I do this ? I tried doing this using excludes of maven-jar-plugin, but not able to succeed.

like image 519
Raaji Avatar asked Jul 06 '15 08:07

Raaji


1 Answers

Use maven-jar-plugin

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3.1</version>
    <executions>
      <execution>
        <id>default-jar</id>
        <phase>package</phase>
        <goals>
          <goal>jar</goal>
        </goals>
        <configuration>
          <excludes>
            <exclude><!-- package you want to exclude --></exclude>
          </excludes>
        </configuration>
      </execution>
    </executions>
</plugin>
like image 59
codeaholicguy Avatar answered Nov 15 '22 00:11

codeaholicguy