Files
maven-plugins/jboss/plugin.jelly
T
vmassol 8321c780b1 <action dev="vmassol" type="fix">
When generating the JBoss server configuration zip, exclude
        JBoss tmp and log directories from the zip.
      </action>
      <action dev="vmassol" type="update">
        Change strategy for bunding J2EE modules in the jboss server
        configuration. This is now achieved through dependencies in
        <code>project.xml</code>. for any J2EE module you want to incude
        add a <code>jboss.bundle</code> property in the said dependency
        definition.
      </action>


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113522 13f79535-47bb-0310-9956-ffa450edef68
2003-06-19 14:06:20 +00:00

315 lines
12 KiB
XML

<?xml version="1.0"?>
<!--
=============================================================================
JBoss plugin for Maven. Contains JBoss related goals useful for
packaging and deploying applications.
=============================================================================
-->
<project
xmlns:ant="jelly:ant"
xmlns:j="jelly:core"
xmlns:util="jelly:util"
xmlns:jmx="jmx"
xmlns:define="jelly:define"
xmlns:artifact="artifact">
<!--
========================================================================
Default goal.
========================================================================
-->
<goal name="jboss"
description="Creates a specific JBoss server configuration"
prereqs="jboss:configure"/>
<!--
========================================================================
Initializations.
========================================================================
-->
<goal name="jboss:init">
<!-- Check if the maven.jboss.home mandatory property is set and point
to a valid location -->
<ant:condition property="jbosshomepresent" value="true">
<ant:and>
<ant:isset property="maven.jboss.home"/>
<ant:available file="${maven.jboss.home}" type="dir"/>
</ant:and>
</ant:condition>
<j:set var="jbosshomepresentX" value="${jbosshomepresent}X"/>
<j:choose>
<j:when test="${jbosshomepresentX == 'X'}">
<fail>You need to set the maven.jboss.home property and make it point to a valid location. It currently points to [${maven.jboss.home}].</fail>
</j:when>
<j:otherwise>
<echo>Using JBoss from ${maven.jboss.home} ...</echo>
</j:otherwise>
</j:choose>
<property name="maven.jboss.build.deploy.dir"
value="${maven.jboss.build.dir}/${maven.jboss.conf.name}/deploy"/>
<property name="maven.jboss.build.lib.dir"
value="${maven.jboss.build.dir}/${maven.jboss.conf.name}/lib"/>
<property name="maven.jboss.build.conf.dir"
value="${maven.jboss.build.dir}/${maven.jboss.conf.name}/conf"/>
</goal>
<!--
========================================================================
Creates a custom JBoss server configuration directory structure
(with no J2EE modules deployed).
========================================================================
-->
<goal name="jboss:configure"
description="Creates a specific JBoss server configuration"
prereqs="jboss:init">
<!-- Copy the JBoss jars from an existing JBoss default server
configuration to our specific configuration -->
<copy todir="${maven.jboss.build.lib.dir}">
<fileset dir="${maven.jboss.default.lib.dir}"
includes="${maven.jboss.default.lib.includes}"
excludes="${maven.jboss.default.lib.excludes}"/>
</copy>
<!-- Copy the JBoss default conf files from an existing JBoss
server configuration to our specific configuration -->
<copy todir="${maven.jboss.build.conf.dir}">
<fileset dir="${maven.jboss.default.conf.dir}"
includes="${maven.jboss.default.conf.includes}"
excludes="${maven.jboss.default.conf.excludes}"/>
</copy>
<!-- Copy the JBoss default deploy files from an existing JBoss
server configuration to our specific configuration -->
<copy todir="${maven.jboss.build.deploy.dir}">
<fileset dir="${maven.jboss.default.deploy.dir}"
includes="${maven.jboss.default.deploy.includes}"
excludes="${maven.jboss.default.deploy.excludes}"/>
</copy>
<!-- Copy the application-specific JBoss conf files to our
specific configuration (if any) -->
<j:set var="jbossconfX" value="${maven.jboss.conf.dir}X"/>
<j:if test="${jbossconfX != 'X'}">
<copy todir="${maven.jboss.build.conf.dir}" overwrite="true">
<fileset dir="${maven.jboss.conf.dir}"/>
</copy>
</j:if>
<!-- Copy the application-specific JBoss deploy files to our
specific configuration (if any) -->
<j:set var="jbossdeployX" value="${maven.jboss.deploy.dir}X"/>
<j:if test="${jbossdeployX != 'X'}">
<copy todir="${maven.jboss.build.deploy.dir}" overwrite="true">
<fileset dir="${maven.jboss.deploy.dir}"/>
</copy>
</j:if>
<!-- Copy the application-specific conf files to our
specific configuration (if any) -->
<j:set var="jbossappconfX" value="${maven.jboss.appconf.dir}X"/>
<j:if test="${jbossappconfX != 'X'}">
<copy todir="${maven.jboss.build.conf.dir}">
<fileset dir="${maven.jboss.appconf.dir}"/>
</copy>
</j:if>
</goal>
<!--
========================================================================
Package J2EE modules in the custom JBoss server configuration
directory structure.
========================================================================
-->
<goal name="jboss:package"
description="Creates a specific JBoss server configuration"
prereqs="jboss:init,jboss:configure">
<j:forEach var="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty('jboss.bundle')=='true'}">
<ant:echo>Bundling: (${dep.groupId}, ${dep.artifactId}, ${dep.type})</ant:echo>
<!-- TODO: Use getDependencyPath() once it supports artifacts other
than jars -->
<copy todir="${maven.jboss.build.deploy.dir}"
file="${maven.repo.local}/${dep.artifactDirectory}/${dep.type}s/${dep.artifact}"/>
</j:if>
</j:forEach>
</goal>
<!--
========================================================================
Generates the zipped JBoss configuration.
========================================================================
-->
<goal name="jboss:dist" prereqs="jboss:package"
description="Generate zipped JBoss configuration">
<!-- Generate the distributable -->
<zip destfile="${maven.build.dir}/${pom.artifactId}-${pom.currentVersion}.zip">
<zipfileset dir="${maven.jboss.build.dir}/${maven.jboss.conf.name}"
prefix="${maven.jboss.conf.name}">
<exclude name="tmp/**"/>
<exclude name="log/**"/>
</zipfileset>
</zip>
</goal>
<!--
========================================================================
Install the produced zip artifact to the local repository
========================================================================
-->
<goal name="jboss:install" prereqs="jboss:dist"
description="Install the zip into the local repository">
<artifact:install
artifact="${maven.build.dir}/${pom.artifactId}-${pom.currentVersion}.zip"
type="zip"
project="${pom}"/>
</goal>
<!--
========================================================================
Start JBoss using our specific server configuration.
========================================================================
-->
<goal name="jboss:start" prereqs="jboss:init"
description="Starts JBoss with our specific server configuration">
<!-- Construct a URL valid on any OS -->
<util:file var="jbossfile"
name="${maven.jboss.build.dir}/${maven.jboss.conf.name}"/>
<j:set var="jbossurl" value="${jbossfile.toURL()}"/>
<java classname="org.jboss.Main" fork="yes" dir="${maven.jboss.home}/bin">
<sysproperty key="program.name" file="${maven.jboss.home}/bin/run.bat"/>
<sysproperty key="jboss.server.home.dir"
file="${maven.jboss.build.dir}/${maven.jboss.conf.name}"/>
<sysproperty key="jboss.server.home.url" value="${jbossurl}"/>
<arg line="-c ${maven.jboss.conf.name}"/>
<classpath>
<pathelement location="${maven.jboss.home}/bin/run.jar"/>
<pathelement path="${java.home}/../lib/tools.jar"/>
</classpath>
</java>
</goal>
<!--
========================================================================
Stop JBoss.
========================================================================
-->
<goal name="jboss:stop" prereqs="jboss:init"
description="Stops JBoss">
<java classname="org.jboss.Shutdown" fork="yes">
<arg value="${maven.jboss.hostname}"/>
<classpath>
<pathelement location="${maven.jboss.home}/bin/shutdown.jar"/>
</classpath>
</java>
</goal>
<!--
========================================================================
Various deploy/undeploy goals.
Note: The war plugin's war:webapp goal will create an exploded warfile
at ${maven.build.dir}/${pom.artifactId}. If you want to deploy
that then it really should be ${maven.build.dir}/${pom.artifactId}.war.
Thus, in your project.properties, you should set maven.war.webapp.dir
to ${maven.build.dir}/${pom.artifactId}.war. In an ideal world that
would be the default value. I'm not sure why it isn't and I don't
want to change it because someone may be relying on the existing
behavior.
You have been warned!
========================================================================
-->
<goal name="jboss:deploy-exploded-warfile" prereqs="war:webapp"
description="Invoke the 'war:webapp' goal and deploy the result. Note that 'maven.war.webapp.dir' *must* end with '.war' for this to work correctly.">
<jmx:deploy jmx.deploy.file='${context.getVariable("maven.war.webapp.dir")}'/>
</goal>
<goal name="jboss:undeploy-exploded-warfile"
description="Undeploy the result of the 'war:webapp' goal. Note that 'maven.war.webapp.dir' *must* end with '.war' for this to work correctly.">
<jmx:undeploy jmx.deploy.file='${context.getVariable("maven.war.webapp.dir")}'/>
</goal>
<goal name="jboss:deploy-warfile" prereqs="war:war"
description="Invoke the 'war' goal and deploy the result">
<jmx:deploy jmx.deploy.file='${maven.build.dir}/${maven.war.final.name}'/>
</goal>
<goal name="jboss:undeploy-warfile" prereqs="war:init"
description="Undeploy the result of the 'war' goal">
<jmx:undeploy jmx.deploy.file='${maven.build.dir}/${maven.war.final.name}'/>
</goal>
<!-- Once maven has a goal that will build a jarfile of EJBs, this should
list it as a prereq -->
<goal name="jboss:deploy-ejb"
description="Deploy ${maven.final.name}.jar">
<jmx:deploy jmx.deploy.file='${maven.build.dir}/${maven.final.name}.jar'/>
</goal>
<goal name="jboss:undeploy-ejb"
description="Undeploy ${maven.final.name}.jar">
<jmx:undeploy jmx.deploy.file='${maven.build.dir}/${maven.final.name}.jar'/>
</goal>
<!-- Once maven has a goal that will build an earfile of EJBs, this should
list it as a prereq -->
<goal name="jboss:deploy-ear"
description="Deploy ${maven.final.name}.ear">
<jmx:deploy jmx.deploy.file='${maven.build.dir}/${maven.final.name}.ear'/>
</goal>
<goal name="jboss:undeploy-ear"
description="Undeploy ${maven.final.name}.ear">
<jmx:undeploy jmx.deploy.file='${maven.build.dir}/${maven.final.name}.ear'/>
</goal>
<!--
========================================================================
JMX tags to deploy and undeploy "things"
========================================================================
-->
<define:taglib uri="jmx">
<define:tag name="deploy">
<j:set var="maven.jboss.jmx.url.undeploy"
value='${pom.getPluginContext("maven-jboss-plugin").getVariable("maven.jboss.jmx.url.undeploy")}'/>
<get dest="deploy.log"
src="${maven.jboss.jmx.url.undeploy}file:${jmx.deploy.file}"/>
<j:set var="maven.jboss.jmx.url.deploy"
value='${pom.getPluginContext("maven-jboss-plugin").getVariable("maven.jboss.jmx.url.deploy")}'/>
<get dest="deploy.log"
src="${maven.jboss.jmx.url.deploy}file:${jmx.deploy.file}"/>
</define:tag>
<define:tag name="undeploy">
<j:set var="maven.jboss.jmx.url.undeploy"
value='${pom.getPluginContext("maven-jboss-plugin").getVariable("maven.jboss.jmx.url.undeploy")}'/>
<get dest="deploy.log"
src="${maven.jboss.jmx.url.undeploy}file:${jmx.deploy.file}"/>
</define:tag>
</define:taglib>
</project>