Eric:
See below for what works for me. When I get a chance, I'll try to archive an working example and put it on a Wiki page.
/Craig

<?xml version="1.0" encoding="UTF-8"?>
<!--
         Generic portlet build for Pluto 1.1.
         
         This build assumes that files are layed out in a directory structure as it
         would be for a Maven 2 build with the addition of a lib directory for
         build and deployment dependancies.
         
         The following jars are required to be in the lib directory
         (obtained from a local Pluto build or the Maven 2 repository):
         1. castor.jar (castor-0.9.6.jar)
         2. commons-logging.jar (commons-logging-1.0.4.jar)
         3. portlet.jar (portlet-api-1.0.jar)
         4. servlet.jar (servlet-api-2.3.jar)
         These jars are build from a source distribution of Pluto 1.1:
         5. pluto-ant-tasks.jar (pluto-ant-tasks-1.1.0-dev.jar)
         6. pluto-descriptor-api.jar (pluto-descriptor-api-1.1.0-dev.jar)
         7. pluto-descriptor-impl.jar (pluto-descriptor-impl-1.1.0-dev.jar)
         8. pluto-util.jar (pluto-util-1.1.0-dev.jar)
         
         Chance module.name in build.properties to the name of your portlet app.
         
         The build needs portlet.xml and web.xml files in src/main/webapp/WEB-INF and a Tomcat context
         deployment descriptor in src/main/resources. Here is an example for a portlet deployed as
         HelloWorldPortlet (HelloWorldPortlet.xml):

                <Context path="HelloWorldPortlet"
                        docBase="..\PlutoDomain\HelloWorldPortlet.war"
                        crossContext="true"/>        
       
         Deployment also requires adding the proper records to pluto-portal-driver-config.xml
         in the WEB-INF directory of the Pluto install. Here is an example for a portlet deployed as
         HelloWorldPortlet:
         
           <portlet-app>
            <context-path>/HelloWorldPortlet</context-path>
            <portlets>
              <portlet name="HelloWorldPortlet"/>
            </portlets>
          </portlet-app>
       
          <render-config>
                  ....
                 
            <page name="HelloWorldPortlet" uri="/WEB-INF/themes/pluto-default-theme.jsp">
              <portlet context="/HelloWorldPortlet" name="HelloWorldPortlet"/>
            </page>
          </render-config>

-->
<project name="portlet-build" default="build" basedir=".">

        <property environment="env"/>  
        <!-- Set CATALINA_HOME or use -Dpluto.home=/path/to/tomcat-with-pluto on command line -->
        <property name="pluto.home" value="${env.CATALINA_HOME}"/>
        <property file="build.properties"/>

        <!-- All jars used by your portlet need to be in lib in addition to the
        pluto-ant-tasks jar -->        
         <path id="project.classpath">
                 <fileset dir="lib">
                         <include name="*.jar"/>
                 </fileset>
        </path>

        <taskdef
                 name="assemble"
                 classname="org.apache.pluto.ant.AssembleTask"
                 classpathref="project.classpath"
                 />

        <target name="init" description="Creates build dirs">
                <echo message="Ant version = ${ant.version}"/>
                <mkdir description="Creates build directory if needed" dir="${build.dir}"/>
                <mkdir description="Creates war directory if needed" dir="${webbuild.dir}"/>
                <mkdir description="Creates WEB-INF directory if needed" dir="${webbuild.dir}/WEB-INF"/>
                <mkdir description="Creates WEB-INF/classes directory if needed" dir="${classbuild.dir}"/>
                <mkdir description="Creates WEB-INF/lib directory if needed" dir="${webbuild.dir}/WEB-INF/lib"/>
        </target>

        <target name="compile" depends="init" description="Compiles source">
                <javac classpathref="project.classpath"
                        fork="yes"
                        debug="true"
                        debuglevel="lines,vars,source"
                        destdir="${classbuild.dir}"
                        srcdir="${java.src.dir}"/>
        </target>
       
        <target name="war" depends="compile">

                <!-- Move web files excluding web.xml  -->
                <copy todir="${webbuild.dir}/">
                    <fileset dir="${web.dir}" excludes="**/web.xml"/>
                </copy>

                <!-- Move other neccessary libraries -->
                <copy todir="${webbuild.dir}/WEB-INF/lib/">
                        <fileset dir="${lib.dir}">
                                <include name="**/*.jar"/>
                                <exclude name="castor*.jar"/>
                                <exclude name="pluto*.jar"/>
                                <exclude name="portlet*.jar"/>
                                <exclude name="servlet*.jar"/>
                                <exclude name="junit*.jar"/>
                        </fileset>                
                </copy>

                <antcall target="assemble"/>
               
                <!-- Create war in deployment directory -->
                <war basedir="${webbuild.dir}" update="false"
                        warfile="${app.name}.war"
                        webxml="${build.dir}/web.xml"/>
        </target>


        <target name="assemble">
                <assemble
                         webxml="${web-inf.dir}/web.xml"
                         portletxml="${web-inf.dir}/portlet.xml"
                         destfile="${build.dir}/web.xml"
                 />
        </target>

        <target name="build" depends="clean,war"/>

        <target name="deploy" depends="build">
                <echo message="Deploying to pluto.home=${pluto.home}"/>
                <!-- Remove former deployment because sometimes
                tomcat does not fully redeploy a war -->
                <delete
                  dir="${pluto.home}/webapps/${app.name}"
                  failonerror="true"
                />
                <!-- Deploy war file -->
                <copy
                  file="${app.name}.war"                
                  todir="${pluto.home}/PlutoDomain"
                  overwrite="true"
                />
                <!-- Deploy context deployment descriptor for Tomcat -->
                <copy
                  file="${conf.dir}/${app.name}.xml"                
                  todir="${pluto.home}/conf/Catalina/localhost"
                  overwrite="false"
                />

        </target>

        <target name="clean" description="Cleans build">
                <delete dir="${build.dir}" failonerror="false"/>
        </target>
       
</project>


#build.properties
#Standard properties for Ant build of a Pluto 1.1 portlet

#module name
app.name=HelloWorldPortlet

#Directory that holds source code
src.dir = src/main
java.src.dir = ${src.dir}/java

#Directory that holds documentation
doc.dir = docs

#Directory that holds files to be built into a jar, war or ear
build.dir = build
webbuild.dir = ${build.dir}/webapp
classbuild.dir =  ${webbuild.dir}/WEB-INF/classes

#Directory that holds configuration files
conf.dir = ${src.dir}/resource

#Directory that holds libraries required to build and run the classes
lib.dir = lib

#Directory that holds webapp files
web.dir = ${src.dir}/webapp

#WEB-INF directory
web-inf.dir = ${web.dir}/WEB-INF


#Directory that holds files to build distribution
dist.dir = ${build.dir}/dist




"Eric Chow" <[EMAIL PROTECTED]>

07/26/2006 10:11 PM

Please respond to
[email protected]

To
[email protected]
cc
Subject
Pluto 1.1 publis Ant task





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 ?


Best regards,
Eric

Reply via email to