o.h.m.e.h.MavenExecutionResultHandler - Build failed with exception(s)
o.h.m.e.h.MavenExecutionResultHandler - [1] java.lang.OutOfMemoryError: Java heap space
Closing connection to remote
Java heap space -> [Help 1]
If you are using Maven on hudson for continuous integration and if there is a error for outofmemory then
- Navigate Hudson -> [project] -> configuration
- Build -> Invoke Maven 3 -> JVM option
- put following parameter in that property -Xmx1024m -XX:MaxPermSize=256m -XX:+DisableExplicitGC
Other way is you can set following in mvn file
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
You can read any attribute of MANIFEST.MF file. The below example show you to read the attribute for any JAR file in the CLASSPATH , here I am trying to read the Version number.
public String getVersion() {
String version=null;
try{
Enumeration <URL> resources =getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
while(resources.hasMoreElements()){
URL url = resources.nextElement();
if(StringUtils.contains(url.getFile(), "fileName")){
Manifest manifest = new Manifest(url.openStream());
version =manifest.getMainAttributes().getValue("Implementation-Version");
break;
}
}
}catch(Exception ex){
log.error("ERROR while readign the Version "+ ex.getLocalizedMessage());
}
return version;
}