Environment variables are not used as Jenkins does not run the maven helper shell but stats maven diretly with some trickery via java, you will need to specify the MAVEN_OPTS in the advanced section (IIRC) of the maven configuration for the job - or specify the arguments directly on the release goals and options in the release section.

/James

On 23/06/2015 06:42, Indra Gunawan (ingunawa) wrote:
I am getting the same error.

I have set the MAVEN_OPTS to the build environment section of the job via EnvInject but it is not passed to the maven release.

The m2/3 type job does clean deploy with "-Xms512m –Xmx2048m” MAVEN_OPTS.
I am setting the MAVEN_OPTS again in Build Environment -> Inject environment variables to the build process” : MAVEN_OPTS='-Xms512m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m’

However the maven release is still failing with OOM PermGen.

I see this in the console:

At revision 154784
[EnvInject] - Executing scripts and injecting environment variables after the 
SCM step.
[EnvInject] - Injecting as environment variables the properties content
MAVEN_OPTS='-Xms512m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m’
…
[checkout] $ /users/px-build/commonTools/java/jdk1.7.0_67/LNX-64/bin/java 
-Xms512m -Xmx2048m -cp 
/scratch/jenkins_slave_sjc-bld62-lnx/maven3-agent.jar:/users/px-build/commonTools/maven/sjc-hudson62-lnx/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar
 org.jvnet.hudson.maven3.agent.Maven3Main 
/users/px-build/commonTools/maven/sjc-hudson62-lnx/apache-maven-3.0.4 
/scratch/jenkins_slave_sjc-bld62-lnx/slave.jar 
/scratch/jenkins_slave_sjc-bld62-lnx/maven3-interceptor.jar 
/scratch/jenkins_slave_sjc-bld62-lnx/maven3-interceptor-commons.jar 38360
…
Executing Maven:  -B -f 
/scratch/jenkins_slave_sjc-bld62-lnx/workspace/comp-ps_cluster_parent-PI_3_0_NIHAU/checkout/pom.xml
 
-Dmaven.repo.local=/scratch/jenkins_slave_sjc-bld62-lnx/workspace/comp-ps_cluster_parent-PI_3_0_NIHAU/.repository
 -DdevelopmentVersion=3.0.29-SNAPSHOT -DreleaseVersion=3.0.28 -e -B 
-Prelease-profile -DgenerateReleasePoms=true release:prepare release:perform 
-Dresume=false -s 
/users/px-build/commonTools/maven/sjc-hudson62-lnx/apache-maven-3.0.4/conf/settings-rel.xml
 -Dmaven.test.skip=true
…
-Indra

From: <[email protected] <mailto:[email protected]>> on behalf of James Nord <[email protected] <mailto:[email protected]>> Reply-To: "[email protected] <mailto:[email protected]>" <[email protected] <mailto:[email protected]>>
Date: Friday, April 17, 2015 at 11:28 AM
To: "[email protected] <mailto:[email protected]>" <[email protected] <mailto:[email protected]>> Subject: Re: M2 Release Plugin - MAVE_OPTS not picked up and getting java.lang.OutOfMemoryError: PermGen space

The memory arguments don't get injected randomly - so I would track down where the values 384m and 192m are set and work backwards.

If possible can you post your job config.xml and the full output of the build?

/James



On Friday, 10 April 2015 16:56:59 UTC+1, Keith O'Brien wrote:

    Hi all,

    I have a Maven build configured on our Jenkins CI (1.608) server
    and the following MAVEN_OPTS configured inBuildsection of the
    job and have m2release plugin v0.14.0 installed.

    |
    -XX:MaxPermSize=512m-Xmx2048m
    |


    When running a regular build (clean install) everything works as
    expected, however if I try running a Maven Release Build I'm
    getting the dreaded "java.lang.OutOfMemoryError: PermGen space"
    error. So I have tried setting up my Maven project as best
    possible, setting JVM args on the appropriate plugins etc, but the
    root of the problem seem to be that the Maven process being
    executed by the m2release plugin isn't picking up either the
    Global MAVEN_OPTS variable I have added or the values above from
    the job configuration, instead from the box itself I can see that
    the following command is being run:

    |
    /usr/lib/jvm/jdk1.7.0_65/bin/java
    -Dmaven.repo.local=/var/jenkins/.m2/repository
    -Xmx384m-XX:MaxPermSize=192m-classpath
    
/usr/local/maven/boot/plexus-classworlds-2.5.1.jar-Dclassworlds.conf=/usr/local/maven/bin/m2.conf
    -Dmaven.home=/usr/local/maven
    org.codehaus.plexus.classworlds.launcher.Launcher-B -D
    maven.repo.local=/var/jenkins/.m2/repository -s
    /tmp/release-settings2394907685413605920.xml -D
    java7.path=/usr/lib/jvm/jdk1.7.0_65/bin/java -D
    maven.release=true-P artifactory clean verify
    |

    .. from this the MaxPermSize is being set to 192m and not the 512m
    I have configured everywhere else.  To prove that this is the
    cause of my problem I have changed the values in this command and
    run it directly on the Jenkins server with a successful result.


    Can anyone tell me how I can change the JVM args on this forked
    maven build?

    Thanks,

    Keith.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1a3000be-3224-46a7-b24c-ce8e95b9b6b5%40googlegroups.com <https://groups.google.com/d/msgid/jenkinsci-users/1a3000be-3224-46a7-b24c-ce8e95b9b6b5%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/D1AE3E8F.10757%25ingunawa%40cisco.com <https://groups.google.com/d/msgid/jenkinsci-users/D1AE3E8F.10757%25ingunawa%40cisco.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5597EB2C.5080401%40teilo.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to