Issue
I need to compile a webapp created with Netbeans (7.2) in Jenkins and I have an error indicating that I need to pass this argument to Ant:
-Dj2ee.server.home=<app_server_installation_directory>
I would like to compile the project without Tomcat or Glassfish dependency in Windows and Linux. Is it possible?
Solution
The solution is to create a -pre-build task in build.xml Ant script to download Tomcat (or Glassfish) and set j2ee.server.home dependency to the correct library path.
<target name="-post-clean">
<deltree dir="download" />
<deltree dir="temp" />
</target>
<!--<target name="-pre-init" depends="check-dependencies" if="tomcat.present">-->
<target name="-pre-init">
<property name="custom-tomcat-version" value="apache-tomcat-7.0.33" />
<mkdir dir="temp"/>
<get src="http://apache.rediris.es/tomcat/tomcat-7/v7.0.33/bin/apache-tomcat-7.0.33.zip" dest="temp/${custom-tomcat-version}.zip"/>
<unzip dest="download/image" src="temp/${custom-tomcat-version}.zip">
<patternset>
<include name="apache-tomcat-7.*/lib/*"/>
</patternset>
<mapper>
<globmapper from="apache-tomcat-7.*/lib/*" to="*"/>
</mapper>
</unzip>
<!-- NB Ant script requieres this propertie to be assigned -->
<property name="j2ee.server.home" value="download/image/${custom-tomcat-version}"/>
</target>
¡¡Bien!! It works like a charm!!
Answered By - gavioto