0

I'm trying to create 2 jars from the same project.

using assembly

 <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.5</version>
            <executions>
                <execution>
                    <id>Mock-1</id>
                    <configuration>
                        <finalName>Mock-1</finalName>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <mainClass>mock.DSlauncher.Launcher</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>

                <execution>
                    <id>Mock-2</id>
                    <configuration>
                        <finalName>Mock-2</finalName>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <mainClass>mock.DSlauncher.Launcher_search</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>

The maven output :

[INFO] 
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ MockLibirator ---
[INFO] Building jar: .../Project/UAT-Mock/target/MockLibirator-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-assembly-plugin:2.5.5:single (Mock-1) @ MockLibirator ---
[INFO] Building jar: .../Project/UAT-Mock/target/Mock-1-jar-with-dependencies.jar
[INFO] 
[INFO] --- maven-assembly-plugin:2.5.5:single (Mock-2) @ MockLibirator ---
[INFO] Building jar: .../Project/UAT-Mock/target/Mock-2-jar-with-dependencies.jar
[WARNING] Artifact CVM-Automation:MockLibirator:jar:jar-with-dependencies:1.0-SNAPSHOT already attached to project, ignoring duplicate

Is there a way not to compile a default jar (the first one) and to fix the warning message...

Thanks

Igal
  • 4,603
  • 14
  • 41
  • 66
  • 1
    Possible duplicate of [disable the execution: default-jar](http://stackoverflow.com/questions/4101750/disable-the-execution-default-jar) – Tunaki Feb 10 '16 at 12:53
  • What you want is to disable the execution of the `maven-jar-plugin`. This execution is made by default by Maven to create the main artifact. Read the linked question. – Tunaki Feb 10 '16 at 12:54

0 Answers0