Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven-assembly-plugin fails with GC Overhead limit exceeded

I have a multi-module maven project. One of the modules uses maven-assembly-plugin. When running mvn clean install on the whole project, the build fails with GC Overhead limit exceeded error.

I am using maven 3.3.9 (tried also with 3.2.2). The maven-assembly-plugin is in version 2.5.5 (tried also with 2.6). Here is the plugin configuration:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
        <execution>
            <id>dist-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <classifier>all</classifier>                 
        <finalName>${project.artifactId}-${project.version}-all</finalName>
        <attach>false</attach>
        <appendAssemblyId>false</appendAssemblyId>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib</classpathPrefix>
                <mainClass>...my main class...</mainClass>
            </manifest>
            <manifestEntries>
                <Implementation-Build>${buildNumber}</Implementation-Build>
            </manifestEntries>
        </archive>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
    </configuration>
</plugin>

I have even set MAVEN_OPTS to following, but didn't help:

MAVEN_OPTS="-Xms2048m -Xmx4096m -XX:PermSize=1024m"

The last message before failing is:

Cleaning up unclosed ZipFile for archive .../.m2/repository/org/bouncycastle/bcprov-jdk16/1.46/bcprov-jdk16-1.46.jar
like image 939
Filip Majernik Avatar asked Sep 27 '16 11:09

Filip Majernik


2 Answers

Moving to maven-assempbly-plugin version 3.2.0 solved it for me and sped up the build significantly

  <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>3.2.0</version>
     .....
like image 188
Aleksandar Trposki Avatar answered Oct 20 '22 04:10

Aleksandar Trposki


Suffering with exactly the same problem, I've got it working by simply increasing max heap space to: -Xmx6g

like image 28
Forge_7 Avatar answered Oct 20 '22 04:10

Forge_7