Deployer Task
The following instructions demonstrate how to create a 'deployer' task within Ant. This task currently allows an Ant build script to update an existing web.xml file with the appropriate servlet wrappers. This allows a WAR file containing JSR-168 portlets to be built and deployed to an external uPortal.
Instructions
1. Copy the attached Deployer.java, DeployerException.java and DeployerTask.java to your uPortal source code. Place the files in 'source/org/jasig/portal/container/deploy'.
2. Add the following target to your uPortal build.xml file.
<!-- ==================== Build Deployer JAR Target ======================= --> <target name="buildDeployerJAR" depends="compile" description="Build the deployer JAR file"> <!-- Make sure the distrubution diretory exists --> <mkdir dir="${dist.home}" /> <!-- Create application JAR file --> <jar destfile = "${dist.home}/deployer.jar" basedir = "${build.home}/WEB-INF/classes"> <manifest> <attribute name="Main-Class" value="org.jasig.portal.container.deploy.Deployer" /> </manifest> </jar> </target>
3. Add the Ant JAR to your uPortal project classpath, otherwise the DeployerTask.java won't compile.
4. Execute the 'buildDeployerJAR' target, which will create the file '${dist.home}/deployer.jar'. This JAR file contains the Deployer.
5. Add the deployer.jar to your Ant classpath For example, in Eclipse, Window->Preferences...->Ant->Runtime->Ant Home Entries->Add JARs
6. Add the Pluto, Portlet API, and Commons Logging JAR files to the Ant classpath, as above.
7. Add the following target to your portlet project's build.xml file.
<taskdef name="deployer" classname="org.jasig.portal.container.deploy.DeployerTask" /> <target name="updateWebXML" description="Updates the web.xml file for deploying into uPortal" depends="compile"> <echo message="Invoking Portlet Application Deployment Tool" /> <deployer webmodule = "${app.name}" webXML = "${build.home}/WEB-INF/web.xml" portletXML = "${build.home}/WEB-INF/portlet.xml" /> </target>
8. Either execute the updateWebXML target or make it a dependency of your WAR building target. This will make sure the web.xml file that was placed in the build directory is appropriately wrapper.
Please feel free to incorporate this code and documentation into future uPortal releases. Also, feel free to fix, enhance, upgrade, or update any of the attached code or documentation! This has been slightly tested against uPortal 2.5.1 using the libraries distributed with that build. Also, Eclipse 3.1.1 was used to test this task.