maven-plugins/was40/plugin.jelly

165 lines
4.9 KiB
XML

<?xml version="1.0"?>
<project
xmlns:define="jelly:define"
xmlns:j="jelly:core"
xmlns:u="jelly:util"
xmlns:was40wscp="was40wscp">
<!-- set up maven.was40.script -->
<j:choose>
<j:when test="${systemScope['os.name'].startsWith('Windows')}">
<j:set var="maven.was40.script" value="${maven.was40.wscpExe}.bat"/>
<j:set var="maven.was40.startServer.script"
value="${maven.was40.bin}/adminserver.bat" />
</j:when>
<j:otherwise>
<j:set var="maven.was40.script" value="${maven.was40.wscpExe}.sh"/>
<j:set var="maven.was40.startServer.script"
value="${maven.was40.startNode}.sh" />
</j:otherwise>
</j:choose>
<!-- set up some tags to make calling wscp easier -->
<define:taglib uri="was40wscp">
<!--
! Execute a command using the WebSphere Control Program
! @param command the wscp command to execute
! @param var (optional) a variable to set with the results of the execution
!-->
<define:tag name="exec">
<j:if test="${empty(command)}">
<fail>attribute command must be provided</fail>
</j:if>
<!-- delete the properties file here and recreate it -->
<delete file="${java.io.tmpdir}/was40.properties" />
<j:file name="${java.io.tmpdir}/was40.properties" omitXmlDeclaration="true" escapeText="false">
wscp.hostName=${maven.was40.node}
</j:file>
<u:file name="${java.io.tmpdir}/was40.properties" var="props" />
<echo>Executing '${command}' using wscp</echo>
<exec executable="${maven.was40.script}" outputproperty="results">
<arg value="-p" />
<arg value="${props.canonicalPath}" />
<arg value="${maven.was40.wscpArgs}" />
<arg value="${command}" />
</exec>
<j:if test="${empty(var)}">
<echo>Result: ${results}</echo>
</j:if>
<j:if test="${!empty(var)}">
<j:set scope="parent" var="${var}" value="${results}" />
</j:if>
</define:tag>
</define:taglib>
<!-- default goal -->
<goal name="was40"
description="Obtain the list of nodes on the WebSphere Application Server">
<attainGoal name="was40:list-node" />
</goal>
<goal name="was40:start"
description="Starts was40 Application Server">
<echo>Please Wait... Starting node</echo>
<exec executable="${maven.was40.startServer.script}" />
</goal>
<goal name="was40:stop"
description="Stops a websphere node">
<echo>Please Wait... Stopping node</echo>
<was40wscp:exec command="${maven.was40.stopNode} /${maven.was40.cmd.node}:${maven.was40.node}/" />
</goal>
<goal name="was40:list-node" description="Obtain the list of nodes on the WebSphere Application Server">
<echo>Obtaining node name ...Please Wait.</echo>
<was40wscp:exec command="${maven.was40.listNode}" />
<!-- uncomment to view results and change the above to have var="results"
<u:tokenize var="nodeName" delim=":">${results}</u:tokenize>
<u:tokenize var="node" delim="/">${nodeName[1]}</u:tokenize>
<j:set var="maven.was40.node" value="${node[0]}" />
<echo>variable: maven.was40.node=${maven.was40.node}</echo>
-->
</goal>
<goal name="was40:deploy-ear"
description="Deploy an enterprise application">
<echo>Please Wait... Deploying enterprise application</echo>
<was40wscp:exec command="${maven.was40.deployApp}" />
</goal>
<goal name="was40:app-stop"
description="Stop an enterprise application">
<echo>Stopping enterprise application</echo>
<was40wscp:exec command="${maven.was40.stopApp}" />
</goal>
<goal name="was40:undeploy-ear"
description="Remove an enterprise application">
<echo>Please Wait... Removing enterprise application</echo>
<was40wscp:exec command="${maven.was40.removeApp}" />
</goal>
<goal name="was40:app-start"
description="Start enterprise application">
<echo>Please Wait... Starting enterprise application</echo>
<was40wscp:exec command="${maven.was40.startApp}" />
</goal>
<goal name="was40:deploy-to-servergroup"
description="Deploy an application to a server group">
<echo>Please Wait... Deploying enterprise application to server group</echo>
<was40wscp:exec command="${maven.was40.servergroup.install}" />
</goal>
<goal name="was40:start-appserver"
description="Start a websphere application server">
<was40wscp:exec command="${maven.was40.appserver.start}" />
</goal>
<goal name="was40:stop-appserver"
description="Stop a websphere application server">
<was40wscp:exec command="${maven.was40.appserver.stop}" />
</goal>
<goal name="was40:start-servergroup"
description="Start a websphere server group">
<was40wscp:exec command="${maven.was40.servergroup.start}" />
</goal>
<goal name="was40:stop-servergroup"
description="Stop a websphere server group">
<was40wscp:exec command="${maven.was40.servergroup.stop}" />
</goal>
</project>