Try the 'environment' parameter to the bash script resource (it's
actually from the Execute resource, but this inherits that)
bash 'foo' do
environment 'MAVEN_OPTS' => '-Xms1024m -Xmx2048m -XX:MaxPermSize=500m'
end
etc.
Maybe consider structuring it a little different as well? Write a
shell script or similar, included in your code-base which wraps your
'mvn install', then just run that from Chef. That way you can re-run
or developers could run it if you're hooning around by hand anyway.
Just a thought :)
--AJ
On 11 May 2013 10:38, Mark H. Nichols < "> > wrote:
> I am creating a recipe to build JBoss AS 7.1.3 from source. The recipe works
> until the Maven build runs out of Java heap space. On the virtual machine
> I've set MAVEN_OPTS and JAVA_OPTS via a .bashrc file:
>
> MAVEN_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=500m'
>
> JAVA_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=512m -noverify'
>
>
> …
>
>
> export MAVEN_OPTS JAVA_OPTS …
>
>
>
> However these environment settings are for the 'vagrant' user on the VM and
> I suspect that the chef solo provisioner runs things as 'root'.
>
> I tried adding an export of JAVA_OPTS and MAVEN_OPTS to the recipe to force
> the memory setting regardless of the active user:
>
> …
>
> bash "mvn install -DskipTests" do
>
> code <<-EOH
>
> cd /home/vagrant/src/jbossas
>
> export MAVEN_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=500m'
>
> export JAVA_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=512m -noverify'
>
> /usr/local/maven3/bin/mvn install -DskipTests -Dcheckstyle.skip=true
>
> EOH
>
> end
> …
>
>
> But that too resulted in an "out of Java heap space" error.
>
> Obviously I am missing something. How do I ensure that my recipe has the
> heap space it requires?
>
> Thanks,
> Mark Nichols
Archive powered by MHonArc 2.6.16.