Re: Ant Task changes for war generation

From: Stefan Klein (stefan.klei..uero-sde.de)
Date: Wed Aug 27 2008 - 15:20:36 EDT

  • Next message: Andrew Sardone: "JAR Dependency Problem"

    In the build script is a fix for the web.xml:
    <!-- fix the web.xml file: the app itself needs project.name/Contents -->
    But this one doesn't work on windows, because in the generated web.xml
    under Windows their are sometimes backslashes (sigh).
    So I changed in my build.xml all occurrences of Window specific stuff.
    The changes in Windows classpath might be unnecessary, but I saw the fix
    for Mac and copied it.
    The WOTagLib changes relate to WOL-843

    Stefan

    Chuck Hill schrieb:
    >
    > On Aug 27, 2008, at 9:02 AM, David Avendasora wrote:
    >
    >> You are likely correct that I've been lucky.
    >>
    >> My windows CLSSPATH.TXT does reflect the bad path, but my web.xml has
    >> the right one. Does the web.xml override the classpath files for a
    >> servlet?
    >
    > I don't use Tomcat, but my expectation is that web.xml would be in
    > control and the other classpath stuff irrelevant.
    >
    >
    > Chuck
    >
    >
    >>
    >>
    >> I really don't fully understand the inner-workings of WO when it
    >> comes to deployment. I just know that what I currently have works on
    >> 3 different Tomcat installs.
    >>
    >> Dave
    >>
    >>
    >> On Aug 27, 2008, at 10:37 AM, Stefan Klein wrote:
    >>
    >>> Then your a lucky man.
    >>> But how did Tomcat find your Application class. The Windows class
    >>> path file has the same error as the one that is fixed in the <!--
    >>> fix the Macos*ClassPath.txt files --> section.
    >>>
    >>> Stefan
    >>>
    >>> David Avendasora schrieb:
    >>>> Interesting. I have been deploying to a WAR that runs in Tomcat on
    >>>> Windows Server 2000/2003 and OS X and I don't have to make any of
    >>>> these changes.
    >>>>
    >>>> Dave
    >>>>
    >>>>
    >>>> On Aug 27, 2008, at 7:41 AM, Stefan Klein wrote:
    >>>>
    >>>>> Hi,
    >>>>>
    >>>>> I tried out the war generation (Eclipse 3.3; WOLips 3.3.5390,
    >>>>> WinXP, WO 5.2.4).
    >>>>> To get it work i had to change some lines.
    >>>>> You can find the changes in the attachment (search for SWK).
    >>>>> I think some of the changes are relevant for Mac OS as well.
    >>>>>
    >>>>> Stefan
    >>>>> <project name="FlussWin54" default="build" basedir=".">
    >>>>>
    >>>>> <!-- main targets -->
    >>>>> <!-- add optional targets to depends list if needed -->
    >>>>> <target name="build"
    >>>>> depends="setProps,init.build,build.woapp,ssdd,war" />
    >>>>>
    >>>>> <target name="compileAndBuild"
    >>>>> depends="setProps,init.build,compile,build.woapp,ssdd,war" />
    >>>>>
    >>>>> <target name="install"
    >>>>> depends="setProps,init.install,build.woapp,ssdd,war" />
    >>>>>
    >>>>> <target name="clean" depends="setProps">
    >>>>> <delete dir="dist" />
    >>>>> </target>
    >>>>>
    >>>>> <!-- property determination -->
    >>>>> <target name="setProps">
    >>>>> <property
    >>>>> file="${user.home}${file.separator}build.properties" />
    >>>>> <property file="build.properties" />
    >>>>> <property
    >>>>> file="${user.home}${file.separator}Library${file.separator}wobuild.properties"
    >>>>> />
    >>>>> <condition property="wo.properties.check.failed">
    >>>>> <not>
    >>>>> <and>
    >>>>> <isset property="wo.wosystemroot" />
    >>>>> <isset property="wo.wolocalroot" />
    >>>>> </and>
    >>>>> </not>
    >>>>> </condition>
    >>>>> <fail message="Could not find
    >>>>> ${user.home}${file.separator}Library${file.separator}wobuild.properties."
    >>>>> if="wo.properties.check.failed" />
    >>>>> <property name="install.dir"
    >>>>> value="${wo.wolocalroot}/Library/WebObjects/Applications" />
    >>>>> </target>
    >>>>>
    >>>>> <!-- basic initializations -->
    >>>>> <target name="init.install">
    >>>>> <tstamp />
    >>>>> <property name="dest.dir" value="${install.dir}" />
    >>>>> </target>
    >>>>>
    >>>>> <target name="init.build">
    >>>>> <tstamp />
    >>>>> <property name="dest.dir" value="dist" />
    >>>>> </target>
    >>>>>
    >>>>> <!-- woproject tasks -->
    >>>>> <target name="build.woapp">
    >>>>>
    >>>>> <taskdef name="woapplication"
    >>>>> classname="org.objectstyle.woproject.ant.WOApplication">
    >>>>> </taskdef>
    >>>>>
    >>>>> <!-- add webXML="true" to generate a web.xml file -->
    >>>>> <woapplication name="${project.name}" stdFrameworks="false"
    >>>>> destDir="${dest.dir}"
    >>>>> customInfoPListContent="${customInfoPListContent}"
    >>>>> principalClass="${principalClass}" webXML="${webXML}"
    >>>>> webXML_CustomContent="${webXML_CustomContent}">
    >>>>> <classes dir="${classes.dir}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/classes.include.patternset" />
    >>>>> <excludesfile
    >>>>> name="woproject/classes.exclude.patternset" />
    >>>>> </patternset>
    >>>>> </classes>
    >>>>> <wsresources dir="WebServerResources">
    >>>>> <patternset>
    >>>>> <include name="**/*" />
    >>>>> <exclude name="CVS" />
    >>>>> <exclude name=".svn" />
    >>>>> <excludesfile
    >>>>> name="woproject/wsresources.exclude.patternset" />
    >>>>> </patternset>
    >>>>> </wsresources>
    >>>>> <resources dir="Resources">
    >>>>> <patternset>
    >>>>> <include name="**/*" />
    >>>>> <exclude name="CVS" />
    >>>>> <exclude name=".svn" />
    >>>>> <excludesfile
    >>>>> name="woproject/resources.exclude.patternset" />
    >>>>> </patternset>
    >>>>> </resources>
    >>>>> <resources dir="Components">
    >>>>> <patternset>
    >>>>> <include name="**/*" />
    >>>>> <exclude name="CVS" />
    >>>>> <exclude name=".svn" />
    >>>>> <excludesfile
    >>>>> name="woproject/resources.exclude.patternset" />
    >>>>> </patternset>
    >>>>> </resources>
    >>>>> <frameworks root="${wo.wolocalroot}"
    >>>>> embed="${servletDeployment}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.wo.wolocalroot" />
    >>>>> </patternset>
    >>>>> </frameworks>
    >>>>> <frameworks root="${user.home}"
    >>>>> embed="${servletDeployment}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.user.home" />
    >>>>> </patternset>
    >>>>> </frameworks>
    >>>>> <frameworks root="${wo.wosystemroot}"
    >>>>> embed="${servletDeployment}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.wo.wosystemroot" />
    >>>>> </patternset>
    >>>>> </frameworks>
    >>>>> <otherclasspath root="${wo.wosystemroot}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.classpaths.wo.wosystemroot" />
    >>>>> </patternset>
    >>>>> </otherclasspath>
    >>>>> <lib dir="Libraries">
    >>>>> <include name="*.jar" />
    >>>>> <exclude name="**/*.woa/**" />
    >>>>> </lib>
    >>>>> </woapplication>
    >>>>> </target>
    >>>>>
    >>>>> <!-- optional targets -->
    >>>>>
    >>>>> <!-- war target-->
    >>>>> <!-- To use this target remove the if="${never}" statement and
    >>>>> follow the instructions for the ssdd target -->
    >>>>> <target name="war" if="servletDeployment" depends="ssdd">
    >>>>> <war destfile="${dest.dir}/${project.name}.war"
    >>>>> webxml="${dest.dir}/${project.name}/WEB-INF/web.xml">
    >>>>> <fileset dir="${dest.dir}/${project.name}">
    >>>>> <include name="**" />
    >>>>> </fileset>
    >>>>> </war>
    >>>>> </target>
    >>>>>
    >>>>> <!-- ssdd target-->
    >>>>> <!-- To use this target
    >>>>> 1) remove the if="${never}" statement
    >>>>> 2) change embed=true in the woapp target above
    >>>>> 3) create the LICENSE in your project directory
    >>>>> 4) add JavaWOJSPServlet in your WOFrameworks build path
    >>>>> 5) Edit the build.properties file
    >>>>> 6) set webXML = true
    >>>>> -->
    >>>>> <target name="ssdd" if="servletDeployment" depends="build.woapp">
    >>>>> <mkdir dir="${dest.dir}/${project.name}/WEB-INF/classes" />
    >>>>> <mkdir dir="${dest.dir}/${project.name}/WEB-INF/tlds" />
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    >>>>> <fileset dir="${dest.dir}/${project.name}.woa/Contents/">
    >>>>> <include name="web.xml" />
    >>>>> </fileset>
    >>>>> </copy>
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    >>>>> <fileset dir="."> <!-- SWK fix: replace ".." with "." -->
    >>>>> <include name="LICENSE" />
    >>>>> </fileset>
    >>>>> </copy>
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    >>>>> <fileset dir="${dest.dir}">
    >>>>> <include name="${project.name}.woa/**" />
    >>>>> </fileset>
    >>>>> </copy>
    >>>>> <!-- copy the frameworks to the WEBINFROOT/Library directory
    >>>>> -->
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    >>>>> <fileset dir="${dest.dir}/${project.name}.woa/Contents">
    >>>>> <include name="Library/**" />
    >>>>> </fileset>
    >>>>> </copy>
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/">
    >>>>> <fileset dir="${dest.dir}/${project.name}.woa">
    >>>>> <include name="Resources/**" />
    >>>>> </fileset>
    >>>>> </copy>
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/lib/">
    >>>>> <fileset dir="${dest.dir}/${project.name}/WEB-INF">
    >>>>> <include name="**/Resources/**/*.jar" />
    >>>>> </fileset>
    >>>>> <mapper type="flatten" />
    >>>>> </copy>
    >>>>>
    >>>>> <!-- Get the necessary Frameworks from the webobjects
    >>>>> system root instead of the project wrapper -->
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/lib"
    >>>>> file="${wo.wosystemroot}/Library/Frameworks/JavaWOJSPServlet.framework/WebServerResources/Java/JavaWOJSPServlet_client.jar"
    >>>>> />
    >>>>>
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/tlds">
    >>>>> <fileset
    >>>>> dir="${wo.wosystemroot}/Library/Frameworks/JavaWOJSPServlet.framework/Resources/">
    >>>>>
    >>>>> <include name="WOtaglib_1_0.tld" />
    >>>>> </fileset>
    >>>>> </copy>
    >>>>> <!-- the WebObject Extensions -->
    >>>>> <copy todir="${dest.dir}/${project.name}/WEB-INF/lib">
    >>>>> <fileset
    >>>>> dir="${wo.wolocalroot}/Library/WebObjects/Extensions/"><!-- SWK
    >>>>> fix: added ${wo.wolocalroot} -->
    >>>>> <include name="*.jar" />
    >>>>> <exclude name="servlet.jar" />
    >>>>> </fileset>
    >>>>> <mapper type="flatten" />
    >>>>> </copy>
    >>>>>
    >>>>>
    >>>>> <!-- fix the Macos*ClassPath.txt files -->
    >>>>>
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/${project.name}.woa/Contents/MacOS/MacOSClassPath.txt"
    >>>>> match="APPROOT/Resources/Java/${project.name.lowercase}.jar"
    >>>>> replace="APPROOT/${project.name}.woa/Contents/Resources/Java/${project.name.lowercase}.jar"
    >>>>> byline="true" />
    >>>>>
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/${project.name}.woa/Contents/MacOS/MacOSXServerClassPath.txt"
    >>>>> match="APPROOT/Resources/Java/${project.name.lowercase}.jar"
    >>>>> replace="APPROOT/${project.name}.woa/Contents/Resources/Java/${project.name.lowercase}.jar"
    >>>>> byline="true" />
    >>>>>
    >>>>> <!-- SWK fix Windows\CLSSPATH.TXT -->
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/${project.name}.woa/Contents/Windows/CLSSPATH.txt"
    >>>>> match="APPROOT\\Resources\\Java\\${project.name.lowercase}.jar"
    >>>>> replace="APPROOT/${project.name}.woa/Contents/Resources/Java/${project.name.lowercase}.jar"
    >>>>> byline="true" />
    >>>>>
    >>>>> <!-- SWK fix the UNIXClassPath.txt files -->
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/${project.name}.woa/Contents/Unix/UNIXClassPath.txt"
    >>>>> match="APPROOT/Resources/Java/${project.name.lowercase}.jar"
    >>>>> replace="APPROOT/${project.name}.woa/Contents/Resources/Java/${project.name.lowercase}.jar"
    >>>>> byline="true" />
    >>>>>
    >>>>> <!-- SWK fix Windows : Change the Backslash -->
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/web.xml"
    >>>>> match="WEBINFROOT//" replace="WEBINFROOT/" byline="true" />
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/web.xml"
    >>>>> match="\\Library/WebObjects" replace="/Library/WebObjects"
    >>>>> byline="true" />
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/web.xml"
    >>>>> match="\\Resources\\Java\\" replace="/Resources/Java/"
    >>>>> byline="true" />
    >>>>>
    >>>>> <!-- SWK fix : Path to WOtaglib -->
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/web.xml"
    >>>>> match="/WEB-INF/tlds//WEB-INF/tlds/WOtaglib_1_0.tld"
    >>>>> replace="/WEB-INF/tlds/WOtaglib_1_0.tld" byline="true" />
    >>>>> <!-- fix the web.xml file: the app itself needs
    >>>>> project.name/Contents -->
    >>>>>
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/web.xml"
    >>>>> match="WEBINFROOT/Resources/Java/${project.name.lowercase}.jar"
    >>>>> replace="WEBINFROOT/${project.name}.woa/Contents/Resources/Java/${project.name.lowercase}.jar"
    >>>>> byline="true" />
    >>>>>
    >>>>> <!-- fix the web.xml file to remove the extra Frameworks/
    >>>>> directory level for the frameworks -->
    >>>>>
    >>>>> <replaceregexp
    >>>>> file="${dest.dir}/${project.name}/WEB-INF/web.xml"
    >>>>> match="WEBINFROOT/Frameworks//" replace="WEBINFROOT/"
    >>>>> byline="true" />
    >>>>>
    >>>>> </target>
    >>>>>
    >>>>> <target name="compile" depends="setProps,init.build">
    >>>>> <taskdef name="wocompile"
    >>>>> classname="org.objectstyle.woproject.ant.WOCompile" />
    >>>>> <mkdir dir="bin" />
    >>>>> <wocompile srcdir="Sources" destdir="bin">
    >>>>> <frameworks root="${wo.dir.user.home.library.frameworks}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.user.home" />
    >>>>> </patternset>
    >>>>> </frameworks>
    >>>>> <frameworks root="${wo.wolocalroot}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.wo.wolocalroot" />
    >>>>> </patternset>
    >>>>> </frameworks>
    >>>>> <frameworks root="${wo.wosystemroot}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.wo.wosystemroot" />
    >>>>> </patternset>
    >>>>> </frameworks>
    >>>>> <classpath>
    >>>>> <fileset dir="${wo.wolocalroot}">
    >>>>> <patternset>
    >>>>> <includesfile
    >>>>> name="woproject/ant.frameworks.wo.wolocalroot" />
    >>>>> </patternset>
    >>>>> </fileset>
    >>>>> <fileset dir="Libraries">
    >>>>> <filename name="**/*.jar" />
    >>>>> </fileset>
    >>>>> </classpath>
    >>>>> </wocompile>
    >>>>> </target>
    >>>>> </project>
    >>>>
    >>>>
    >>>
    >>>
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Wed Aug 27 2008 - 15:22:07 EDT