Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not set the final jar name with maven-assembly-plugin

This is how I configured maven-assembly-plugin

<plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-assembly-plugin</artifactId>     <version>2.4</version>     <configuration>         <finalName>myapp</finalName>         <archive>             <manifest>                 <mainClass>com.myapp.Main</mainClass>             </manifest>         </archive>         <!--         <descriptorRefs>             <descriptorRef>jar-with-dependencies</descriptorRef>         </descriptorRefs>         -->     </configuration> </plugin> 

and I expect the final jar file should be myapp.jar but it ends up with myapp-jar-with-dependencies.jar

Can you tell me how to configure to exclude "jar-with-dependencies" out of the final name?

like image 761
Truong Ha Avatar asked Dec 20 '13 05:12

Truong Ha


People also ask

How Maven assembly plugin works?

The Assembly Plugin for Maven enables developers to combine project output into a single distributable archive that also contains dependencies, modules, site documentation, and other files. Your project can easily build distribution "assemblies" using one of the prefabricated assembly descriptors.

What is a plugin assembly?

Plug-in assemblies allow you to run custom C# code on the Resco Cloud as part of the Processes. Plugins can run periodically as jobs or be triggered as workflows. It should solve the limitations of the no-coding editor of processes. There are the typical use cases: complex logic of process.

What is the difference between jar and plugin?

plug-in is a software component that adds a specific feature to any computer program.It specially use to customize any computer program. But . jar file is a java executable file which can only run on an environment which Java installed.


1 Answers

You can specify the finalName property to give the jar the name you want, and specify that appendAssemblyId should be false to avoid the jar-with-dependencies suffix. The configuration below will output a jar called test.jar

         <plugin>             <groupId>org.apache.maven.plugins</groupId>             <artifactId>maven-assembly-plugin</artifactId>             <version>2.4</version>             <configuration>                 <finalName>test</finalName>                 <archive>                     <manifest>                         <mainClass>com.myapp.Main</mainClass>                     </manifest>                 </archive>                 <descriptorRefs>                     <descriptorRef>jar-with-dependencies</descriptorRef>                 </descriptorRefs>                <appendAssemblyId>false</appendAssemblyId>             </configuration>          </plugin> 
like image 138
sasankad Avatar answered Sep 23 '22 10:09

sasankad