Eric Chow wrote:
Hello,
Is there any example to use the Publish Ant task for Pluto-1.1 ?
Will it help adding portlet-app into the pluto-portal-driver-config.xml ?
Here is what I use to build portlets and then hot deploy them into a
tomcat/pluto server (works for most cases)... you just have to make ant
aware of the portlet jars and you might have to compile the ant task
project you get from pluto.
Nate
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="default" name="iframeportlet">
<target name="default" depends="all" description="Build and Deploy
Portlet"/>
<target name="all" depends="deploy" description="Build and Deploy
Portlet">
<echo message="Application built and portlet successfully
deployed"/>
</target>
<target name="noop" description="Print project name">
<echo message="iframeportlet"/>
</target>
<target name="init">
<property name="appserver.home"
value="/java/servers/apache-tomcat-5.5.16"/>
<property name="appserver.lib.dir"
value="${appserver.home}/common/lib"/>
<property name="appserver.deploy.dir"
value="${appserver.home}/webapps"/>
<property name="dist" value="dist"/>
<property name="webapp" value="iframeportlet"/>
<property name="webapp.dir" value="web-root"/>
<property name="classes" value="${webapp.dir}/WEB-INF/classes"/>
<property name="lib" value="${webapp.dir}/WEB-INF/lib"/>
<property name="src" value="src"/>
<property name="webinf-lib" value="webinf-lib"/>
<condition property="isInDevEnvironment">
<equals arg1="${build.environment}" arg2="dev">
</equals>
</condition>
</target>
<target name="buildlib" depends="init">
<mkdir dir="${lib}"/>
<copy todir="${lib}" flatten="true">
<fileset dir="${webinf-lib}">
<include name="**/*.jar"/>
</fileset>
</copy>
<path id="compile.classpath">
<fileset dir="${appserver.lib.dir}" includes="*.jar"/>
<fileset dir="${webinf-lib}" includes="**/*.jar"/>
</path>
</target>
<target name="compile" depends="buildlib">
<mkdir dir="${classes}"/>
<javac debug="true" deprecation="true" destdir="${classes}"
srcdir="${src}">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${classes}">
<fileset dir="${src}">
<include name="**/*.properties"/>
<include name="**/*.dtd"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<taskdef name="assemble" classname="org.apache.pluto.ant.AssembleTask"/>
<target name="assemble" depends="init">
<assemble webxml="${webapp.dir}/WEB-INF/web.xml"
portletxml="${webapp.dir}/WEB-INF/portlet.xml"
destfile="${dist}/temp/WEB-INF/web.xml"/>
</target>
<target name="buildportletwar" depends="compile">
<mkdir dir="${dist}"/>
<mkdir dir="${dist}/temp"/>
<copy todir="${dist}/temp">
<fileset dir="${webapp.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<antcall target="assemble"/>
<jar jarfile="${dist}/${webapp}.war" basedir="${dist}/temp"/>
<delete dir="${dist}/temp"/>
</target>
<target name="deploy" depends="buildportletwar">
<copy todir="${appserver.deploy.dir}"
file="${dist}/${webapp}.war"/>
</target>
<target name="clean" depends="init" description="Clean up">
<delete dir="${dist}"/>
<delete dir="${lib}"/>
<delete dir="${classes}"/>
</target>
</project>