1

I have a Maven project, which uses the Maven Assembly Plugin to build a version of the JAR with its dependencies inside.

In my target folder I see that the Maven has built 2 version of the JAR: one without the dependencies and one with the dependencies.

I see that the version that is copied to my M2 repository is the version with dependencies.

How can I tell Maven to build both versions, but deploy the one without the dependencies to the M2 respository?

Here are parts of my pom.xml:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>2.3</version>                    
</plugin>
<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <descriptorRefs>
     <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    </configuration>
      <executions>
        <execution>
          <id>pack-jar-with-dependencies</id> <!-- this is used for inheritance merges -->
          <phase>package</phase> <!-- bind to the packaging phase -->
          <goals>
            <goal>single</goal>
          </goals>
       </execution>
    </executions>
</plugin>
dur
  • 15,689
  • 25
  • 79
  • 125
AntonKam
  • 163
  • 11
  • 1
    Thank you very much RITZ XAVI, once I've added the false to the configuration of the assembly plugin, the JAR with the dependencies is no longer copied to my .M2, and instead the JAR without the dependencies is there! that is exactly the result I wanted. – AntonKam Nov 17 '16 at 05:44

0 Answers0