Commits

Anonymous committed 3839055

WW-1024: allow building of webapps (war files) in addition to QuickStart

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@1791573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (2)

     <macrodef name="webapp">
         <attribute name="name"/>
         <sequential>
-            <mkdir dir="${dist}/webapps"/>
             <mkdir dir="${dist}/webapps/@{name}/src"/>
-            <compile srcdir="webapps/@{name}/src/java" destdir="webapps/@{name}/build/java" classpath="${build.java}"/>
-            <war file="${dist}/webapps/@{name}.war" basedir="webapps/@{name}/src/webapp"
-                 webxml="webapps/@{name}/src/webapp/WEB-INF/web.xml">
-                <classes dir="webapps/@{name}/build/java"/>
-            </war>
             <copy todir="${dist}/webapps/@{name}/src">
                 <fileset dir="webapps/@{name}/src" includes="**/**"/>
             </copy>
         <webapp name="ajax"/>
         <webapp name="shopping-cart"/>
         <webapp name="portlet"/>
-<!--
         <webapp name="wwia"/>
--->
 
         <!-- copy over elements required to build the final wars -->
         <copy file="webapps/build.xml" todir="${dist}/webapps"/>
                 <attribute name="Implementation-Version" value="${version}"/>
             </manifest>
         </jar>
-        <copy file="${build}/${name}-${version}.jar" tofile="${build}/webwork.jar"/>
     </target>
 
     <target name="dist" depends="common.dist" description="generate distribution zip file">

webapps/build.xml

         </echo>
     </target>
 
+    <path id="cp">
+        <fileset dir="../lib">
+            <include name="**/*.jar"/>
+        </fileset>
+        <fileset dir="..">
+            <include name="webwork-*.jar"/>
+        </fileset>
+        <!-- used for allowing WebWork developers to build wars w/o building the whole distribution -->
+        <path path="../build/java"/>
+    </path>
+
+    <macrodef name="compile">
+        <attribute name="srcdir"/>
+        <attribute name="destdir"/>
+        <attribute name="classpath" default=""/>
+        <attribute name="classpathref" default="cp"/>
+        <attribute name="excludes" default=""/>
+        <attribute name="source" default="1.4"/>
+        <attribute name="target" default="1.4"/>
+        <sequential>
+            <mkdir dir="@{destdir}"/>
+            <javac srcdir="@{srcdir}" destdir="@{destdir}" classpath="@{classpath}" classpathref="@{classpathref}"
+                   debug="on" source="@{source}" target="@{target}"/>
+            <copy filtering="no" todir="@{destdir}">
+                <fileset dir="@{srcdir}">
+                    <exclude name="**/*.java"/>
+                    <exclude name="**/package.html"/>
+                </fileset>
+            </copy>
+        </sequential>
+    </macrodef>
+
     <target name="build">
+        <!-- prepare -->
         <delete dir="${basedir}/tmp"/>
+        <mkdir dir="${basedir}/tmp"/>
         <mkdir dir="${basedir}/dist"/>
-        <copy file="${basedir}/${webapp}.war" todir="dist" overwrite="yes"/>
-        <war update="yes" file="${basedir}/dist/${webapp}.war">
-            <zipfileset file="${basedir}/../../build/webwork.jar" prefix="WEB-INF/lib"/>
+
+        <!-- copy over the webapp -->
+        <copy todir="${basedir}/tmp">
+            <fileset dir="${basedir}/${webapp}/src/webapp"/>
+        </copy>
+
+        <!-- compile the sources -->
+        <mkdir dir="${basedir}/${webapp}/WEB-INF/classes"/>
+        <compile srcdir="${basedir}/${webapp}/src/java" destdir="${basedir}/${webapp}/WEB-INF/classes"/>
+
+        <!-- war up the app -->
+        <war file="${basedir}/dist/${webapp}.war" webxml="tmp/WEB-INF/web.xml">
+            <zipfileset dir="tmp" prefix=""/>
 
             <!-- only these configurations are needed for now. Also, these are probably more than
                  needed, but we're just picking a single set of jars that each webapp can use -->
             <zipfileset dir="${basedir}/../lib/default" prefix="WEB-INF/lib" includes="*.jar"/>
             <zipfileset dir="${basedir}/../lib/fileupload" prefix="WEB-INF/lib" includes="*.jar"/>
             <zipfileset dir="${basedir}/../lib/freemarker" prefix="WEB-INF/lib" includes="*.jar"/>
-        	<!-- DO NOT need pluto.jar & portlet-api.jar in WEB-INF/lib to run portlet in Portal Server -->
-            <!-- zipfileset dir="${basedir}/../../lib/portlet" prefix="WEB-INF/lib" includes="*.jar"/ -->
             <zipfileset dir="${basedir}/../lib/sitemesh" prefix="WEB-INF/lib" includes="*.jar"/>
             <zipfileset dir="${basedir}/../lib/spring" prefix="WEB-INF/lib" includes="*.jar" excludes="commons-logging.jar"/>
             <zipfileset dir="${basedir}/../lib/velocity" prefix="WEB-INF/lib" includes="*.jar"/>