I have been migrating our maven build server over from Maven 2 to Maven 3. I am setting up maven to deploy a new java application to a remote server using scp. However, I get the following messages when I run "mvn install".
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] FooCorp Parent Project
[INFO] FooCorp Daemons
[INFO] FooCorp Transport Objects and Interfaces
[INFO] FooCorp Web Client
[INFO] FooCorp Web Application
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building FooCorp Parent Project S88-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3:install (default-install) @ Foo ---
[INFO] Installing /home/ubuntu/FooCorp/pom.xml to /home/ubuntu/mvn_local_repo/com/Foo/Foo/S88-SNAPSHOT/Foo-S88-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ Foo ---
Downloading: scp://mvn.FooCorp.com/var/www/maven2/com/Foo/Foo/S88-
SNAPSHOT/maven-metadata.xml
Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: Java heap space
at com.jcraft.jsch.IdentityFile.decrypt_rsa(IdentityFile.java:648)
at com.jcraft.jsch.IdentityFile.decrypt(IdentityFile.java:553)
at com.jcraft.jsch.IdentityFile.setPassphrase(IdentityFile.java:435)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:225)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:207)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:200)
at org.apache.maven.wagon.providers.ssh.jsch.AbstractJschWagon.openConnectionInternal(AbstractJschWagon.java:133)
at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:115)
at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:217)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:345)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:385)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:571)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Here is some information about the system I am using.
:> echo $MAVEN_OPTS
-Xmx2000m -Xms256m
:> mvn --version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-36-generic", arch: "amd64", family: "unix"
Running on Ubuntu 14.04 with 4GB total memory.
I get the same error message every time I run mvn install
. The file that is being downloaded in the last command before the java heap space exception ...
Downloading: scp://mvn.FooCorp.com/var/www/maven2/com/Foo/Foo/S88-SNAPSHOT/maven-metadata.xml
... Does exist on the remote server (I have access to it so I checked). Maven seems to have plenty of memory according the the MAVEN_OPTS. Also, I have watched the system memory using the top command and it barely ever uses more than 1.5GB of memory. I have looked at many other solutions to problems such as this and they all involve giving Maven more memory, but I think 2GB should cover whatever maven needs (Might I be wrong). Not sure if this helps, but I am able to run "mvn install" and it works perfectly. The only problem is the maven deploy command.
The wagon plugin is configured in my POM.xml like so
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.4</version>
</extension>
</extensions>
And the maven-deploy-plugin configuration is configured in the POM like this...
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<argLine>-Xmx3000m</argLine>
</configuration>
</plugin>
I have been having a hard time with this, not sure what else to try. Any possible solutions or general advice would be greatly appreciated.
I can add more information if necessary.
Thank you for any help you can provide.
Try increasing the heap size. PFB links for reference.Hope this may help you.
http://javarevisited.blogspot.com/2011/08/increase-heap-size-maven-ant.html
http://javarevisited.blogspot.com/2011/09/javalangoutofmemoryerror-permgen-space.html
:> echo $MAVEN_OPTS -Xmx2000m -Xms256m
Try increasing the size of highlighted bold to -Xms512m and try once again