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

java, maven, maven-3

Solution

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>

Problem

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?

Original source

Related problems