jordiburgos
jordiburgos

Reputation: 6302

maven-assembly-plugin gives java heap space error

Inside a TeamCity build, there is an step to execute a maven-assembly-plugin, after waiting some time (40-50 minutes) it gives java heap space error (see the log):

[15:32:58][com.****:project] [INFO] --- maven-assembly-plugin:2.4:single (make-assembly) @ project ---
[15:33:01][com.****:project] [INFO] Reading assembly descriptor: assembly.xml
[16:20:02][com.****:project] [ERROR] Java heap space -> [Help 1]

The Teamcity is being executed on a Unix environment. The maven step executes "mvn clean deploy" that works correctly on the development Windows machine.

Already tried to set MAVEN_OPTS to:

MAVEN_OPTS = -Xms256m -Xmx1024m
MAVEN_OPTS = -Xms512m -Xmx2048m

Any clue to solve this?

Upvotes: 3

Views: 6725

Answers (1)

jordiburgos
jordiburgos

Reputation: 6302

The problem is about the configuration of the maven-assembly-plugin on Unix.

[09:21:17][com.***:project] [DEBUG] FileSet[lib/] dir perms: -1 file perms: -1 lineEndings: unix
[09:21:17][com.***:project] [DEBUG] The archive base directory is 'null'

The archive base directory is not set on the pom.xml configuration. For this reason, on Unix, assembly was archiving /lib folder instead of /projects/project/lib. Thus, the out of memory error.

This is the line added to the current config:

<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>

This is the resulting configuration:

  <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4</version>
    <executions>
      <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
        <configuration>
          <finalName>project</finalName>
          <appendAssemblyId>false</appendAssemblyId>
          <archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
          <descriptors>
            <descriptor>assembly.xml</descriptor>
          </descriptors>
        </configuration>
      </execution>
    </executions>
  </plugin>

Upvotes: 2

Related Questions