Cargo Maven plugin - raising PermGen for JBoss AS 5

    AS 5 is really greedy when it comes to PermGen. When starting, it often throws OutOfMemoryException: PermGen Error.

     

    You need to tell Cargo to give the AS more than JVM's default, using cargo.jvmargs:

     

    <configuration>
      <!-- Raise permgen size, allow classes unloading and permgen sweep -->
      <properties>
        <cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
      </properties>
    </configuration>

     

    Example in the context of pom.xml

     

    <!-- Cargo plugin (for AS 5) -->
    <plugin>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <version>1.0-SNAPSHOT</version>
      <configuration>
        <wait>false</wait>
        <container>
          <containerId>jboss5x</containerId>
          <home>${JBOSS_HOME}</home>
          <log>${basedir}/target/jboss5.x.logs/cargo.log</log>
          <timeout>300000</timeout> <!-- 5 minutes -->
          <systemProperties>
            <!-- This is used in jboss-log4j.xml -->
            <jboss.server.log.threshold>INFO</jboss.server.log.threshold>
          </systemProperties>
        </container>

        <!-- cargo-configuration - name of the element will hopefully get an alias soon -->
        <configuration>
          <!-- Raise permgen size, allow classes unloading and permgen sweep -->
          <properties>
            <cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
          </properties>
        </configuration>
        <!-- /cargo-configuration -->

      </configuration>
    <plugin>