Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly ID is getting appended when zip file is created by maven

xml and pom.xml which creates jar file and then zip file with some artifacts including jar file. But when i run maven install zip file is getting created as GenerateMissingUsersReport-bin.zip instead I want it to create as GenerateMissingUsersReport.zip. I have set as false. But no difference.

Any pointers?

Here is dep.xml

<id>bin</id>  
<baseDirectory>../</baseDirectory>  
<formats>  
<format>zip</format>  
</formats>  
<fileSets>  
<fileSet>  
<directory>${project.basedir}</directory>  
<outputDirectory>/</outputDirectory>  
<includes>  
<include>README*</include>  
<include>LICENSE*</include>  
<include>NOTICE*</include>  
</includes>  
</fileSet>  
<fileSet>  
<directory>${project.build.directory}</directory>  
<outputDirectory>/lib</outputDirectory>  
<includes>  
<include>*.jar</include>  
</includes>  
</fileSet>  
<fileSet>  
<directory>${project.build.directory}/classes</directory>  
<includes>  
<include>plugin.xml</include>  
</includes>   
<outputDirectory>/</outputDirectory>  
</fileSet>  
</fileSets>  

Here is pom.xml

<finalName>GenerateMissingUsersReport</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                        <finalName>GenerateMissingUsersReport</finalName>
                        <appendAssemblyID>false</appendAssemblyID>
                        <descriptor>src/assembly/dep.xml</descriptor>
            </configuration>
            <executions>
                <execution>
                    <id>make-zip</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
            </execution>
            </executions>
        </plugin>
        <plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.4</version>
    <executions>
      <execution>
        <id>default-jar</id>
        <phase>package</phase>
        <goals>
          <goal>jar</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
    <excludes>
    <exclude>plugin.xml</exclude>
    </excludes></configuration>
    </plugin>
like image 839
user2961454 Avatar asked Jun 12 '15 15:06

user2961454


People also ask

What does Maven do in assembly?

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 fileset in Maven?

Defines the rules for matching and working with files in a given base directory.

Where is Assembly XML?

The default location of assemblies. xml is in the project root directory.

What is goal single in Maven?

This goal is suitable either for binding to the lifecycle or calling directly from the command line (provided all required files are available before the build starts, or are produced by another goal specified before this one on the command line).


1 Answers

Add the following line under configurations element of the pom

<appendAssemblyId>false</appendAssemblyId>

Also make sure you use the latest version of the assembly plugin

<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
like image 90
Santanu Dey Avatar answered Oct 13 '22 20:10

Santanu Dey