o making changes that consist of new features and a better interface of goals for version 2.0
o adding full use of reinstall and restart goals o nooping most goals if their action would be redundant o adding webserver:cycle to attempt a smart figuring of what a typical developer would need for rapid development. This replaces the smarts found in webserver:install and webserver:start in versions 1.x git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113384 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
3b0f7500d4
commit
64f07707cc
1 file changed
+184
-77
+184
-77
@@ -4,14 +4,17 @@
|
||||
<!-- W E B S E R V E R P L U G I N -->
|
||||
<!-- ================================================================== -->
|
||||
<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:log="jelly:log"
|
||||
xmlns:exception="exception" xmlns:define="jelly:define"
|
||||
xmlns:webserver="http://www.maven.org/plugin/webserver">
|
||||
xmlns:exception="http://www.maven.org/plugin/webserver/exception"
|
||||
xmlns:webserver="http://www.maven.org/plugin/webserver"
|
||||
xmlns:define="jelly:define" >
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- S U P P O R T E D W E B S E R V E R S -->
|
||||
<!--==================================================================-->
|
||||
|
||||
<j:import inherit="true" file="${plugin.resources}/apache-2.x.jelly" />
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- B E G I N C O R E P R O C E S S I N G -->
|
||||
<!--==================================================================-->
|
||||
@@ -27,7 +30,7 @@
|
||||
5. Check the ports to make sure they are numbers only
|
||||
-->
|
||||
|
||||
<define:taglib uri="exception">
|
||||
<define:taglib uri="http://www.maven.org/plugin/webserver/exception">
|
||||
<define:tag name="requiredPropertyMissing">
|
||||
<ant:fail message=" ">
|
||||
--------------------------------------------------------------------------
|
||||
@@ -242,104 +245,111 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
</log:info>
|
||||
</j:if>
|
||||
|
||||
|
||||
<!-- DEFINE CORE FUNCTIONALITY -->
|
||||
<!--==================================================================-->
|
||||
<!-- C O R E -->
|
||||
<!--==================================================================-->
|
||||
<define:taglib uri="http://www.maven.org/plugin/webserver">
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- C L E A N -->
|
||||
<!--==================================================================-->
|
||||
<define:tag name="clean">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Deleting webserver instance ...
|
||||
</log:info>
|
||||
|
||||
<!-- allow webservers to have their own cleanup -->
|
||||
<attainGoal name="webserver:clean-${maven.webserver.fullname}" />
|
||||
|
||||
<!-- all clean calls should cleanup the server dir -->
|
||||
<ant:delete dir="${maven.webserver.dir}"/>
|
||||
<attainGoal session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:clean-${maven.webserver.fullname}" />
|
||||
<ant:delete dir="${maven.webserver.dir}"/>
|
||||
</define:tag>
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- I N S T A L L -->
|
||||
<!--==================================================================-->
|
||||
<define:tag name="install">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Installing webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:install-${maven.webserver.fullname}" />
|
||||
<attainGoal
|
||||
session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:install-${maven.webserver.fullname}" />
|
||||
</define:tag>
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- R E I N S T A L L -->
|
||||
<!--==================================================================-->
|
||||
<define:tag name="reinstall">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Re-installing webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:install-${maven.webserver.fullname}" />
|
||||
<attainGoal session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:reinstall-${maven.webserver.fullname}" />
|
||||
</define:tag>
|
||||
|
||||
|
||||
<define:tag name="restart">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Re-starting webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:restart-${maven.webserver.fullname}" />
|
||||
</define:tag>
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- S T A R T -->
|
||||
<!--==================================================================-->
|
||||
<define:tag name="start">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Starting webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:start-${maven.webserver.fullname}" />
|
||||
<attainGoal
|
||||
session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:start-${maven.webserver.fullname}" />
|
||||
</define:tag>
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- R E S T A R T -->
|
||||
<!--==================================================================-->
|
||||
<define:tag name="restart">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Re-starting webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal
|
||||
session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:restart-${maven.webserver.fullname}" />
|
||||
</define:tag>
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- S T O P -->
|
||||
<!--==================================================================-->
|
||||
<define:tag name="stop">
|
||||
<j:choose>
|
||||
|
||||
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') == 'true'}">
|
||||
<log:info trim="false">
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}" />: Stopping webserver instance ...
|
||||
</log:info>
|
||||
<attainGoal name="webserver:stop-${maven.webserver.fullname}" />
|
||||
</j:when>
|
||||
|
||||
<!-- already stopped -->
|
||||
<j:otherwise>
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}"/>: Already stopped!
|
||||
</log:info>
|
||||
</j:otherwise>
|
||||
|
||||
</j:choose>
|
||||
|
||||
</log:info>
|
||||
<attainGoal session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:stop-${maven.webserver.fullname}" />
|
||||
</define:tag>
|
||||
|
||||
</define:taglib>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- I S T A L L -->
|
||||
<!-- C Y C L E -->
|
||||
<!--==================================================================-->
|
||||
<goal name="webserver:install" prereqs="webserver:init"
|
||||
description="Install or reinstall a webserver instance">
|
||||
<goal name="webserver:cycle" prereqs="webserver:init"
|
||||
description="Forced install and start of a webserver instance">
|
||||
|
||||
<!-- all goals will need a webserver dir -->
|
||||
<ant:mkdir dir="${maven.webserver.dir}" />
|
||||
|
||||
<j:choose>
|
||||
<!-- not installed - simply install -->
|
||||
<!-- not installed - simply install and start-->
|
||||
<j:when test="${context.getVariable('maven.webserver.installed') != 'true'}">
|
||||
<webserver:install />
|
||||
<webserver:start />
|
||||
</j:when>
|
||||
|
||||
<!-- installed and stopped -->
|
||||
<j:when test="${context.getVariable('maven.webserver.installed') == 'true' and context.getVariable('maven.webserver.started') != 'true'}">
|
||||
<!-- FIXME - another candidate for the attainGoal session attribute -->
|
||||
<webserver:reinstall />
|
||||
<webserver:start />
|
||||
</j:when>
|
||||
|
||||
<!-- installed and started -->
|
||||
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') == 'true'}">
|
||||
<attain>
|
||||
<!-- FIXME - another candidate for the attainGoal session attribute -->
|
||||
<webserver:stop />
|
||||
<webserver:reinstall />
|
||||
<webserver:start />
|
||||
</attain>
|
||||
<webserver:reinstall />
|
||||
<webserver:restart />
|
||||
</j:when>
|
||||
<!-- one of those 'things' that should never happen -->
|
||||
<j:otherwise>
|
||||
@@ -358,6 +368,40 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- I N S T A L L -->
|
||||
<!--==================================================================-->
|
||||
<goal name="webserver:install" prereqs="webserver:init"
|
||||
description="Install a webserver instance">
|
||||
|
||||
<!-- all goals will need a webserver dir -->
|
||||
<ant:mkdir dir="${maven.webserver.dir}" />
|
||||
|
||||
<j:choose>
|
||||
<!-- not installed - simply install -->
|
||||
<j:when test="${context.getVariable('maven.webserver.installed') != 'true'}">
|
||||
<webserver:install />
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<ant:echo message=" ">
|
||||
--------------------------------------------------------------------------
|
||||
| Plugin Warning |
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Webserver already installed
|
||||
|
||||
You may try
|
||||
o webserver:reinstall
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
</ant:echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- R E I N S T A L L -->
|
||||
<!--==================================================================-->
|
||||
@@ -366,36 +410,67 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
<!-- be custom implementations of reinstall needed -->
|
||||
<!-- by default we just call the install goal again -->
|
||||
<goal name="webserver:reinstall"
|
||||
prereqs="webserver:init, webserver:install-${maven.webserver.fullname}"
|
||||
description="Reinstall a webserver instance" >
|
||||
prereqs="webserver:init" description="Reinstall a webserver instance" >
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${context.getVariable('maven.webserver.installed') != 'true'}">
|
||||
<ant:echo message=" ">
|
||||
--------------------------------------------------------------------------
|
||||
| Plugin Warning |
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Webserver not yet installed
|
||||
|
||||
You may try
|
||||
o webserver:install
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
</ant:echo>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<webserver:reinstall />
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</goal>
|
||||
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- S T A R T -->
|
||||
<!--==================================================================-->
|
||||
<goal name="webserver:start" prereqs="webserver:init"
|
||||
description="Start or restart a webserver instance">
|
||||
description="Start a webserver instance">
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${context.getVariable('maven.webserver.installed') != 'true'}">
|
||||
<attain>
|
||||
<!-- Use the next line when werkz beta 9 is pushed which should
|
||||
contain a session attribute on the attainGoal tag. Using attainGoal
|
||||
here allows the user to write post and pre goals against the
|
||||
webserver:install goal, the likely spot where they will copy webserver
|
||||
files to the webserver installation -->
|
||||
<!-- <attainGoal
|
||||
session="${context.getVariable('maven.session.global', 'parent')}"
|
||||
name="webserver:install" /> -->
|
||||
<!-- The next line will do until the next werkz is pushed and above line is uncommented-->
|
||||
<webserver:install />
|
||||
<webserver:start />
|
||||
</attain>
|
||||
<ant:echo message=" ">
|
||||
--------------------------------------------------------------------------
|
||||
| Plugin Warning |
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Webserver not yet installed
|
||||
|
||||
You may try
|
||||
o webserver:install webserver:start
|
||||
o webserver:cycle
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
</ant:echo>
|
||||
</j:when>
|
||||
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') == 'true'}">
|
||||
<!-- FIXME - another candidate for the session attribute on attainGoal -->
|
||||
<webserver:restart />
|
||||
<j:when test="${context.getVariable('maven.webserver.started') == 'true'}">
|
||||
<ant:echo message=" ">
|
||||
--------------------------------------------------------------------------
|
||||
| Plugin Warning |
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Webserver already started
|
||||
|
||||
You may try
|
||||
o webserver:restart
|
||||
o webserver:cycle
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
</ant:echo>
|
||||
</j:when>
|
||||
<j:when test="${context.getVariable('maven.webserver.installed') == 'true'}">
|
||||
<webserver:start />
|
||||
@@ -404,24 +479,58 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- R E S T A R T -->
|
||||
<!--==================================================================-->
|
||||
<!-- the purpose of this target is to allow the user to be very -->
|
||||
<!-- specific when using pre and post goals -->
|
||||
<goal name="webserver:restart"
|
||||
prereqs="webserver:init,webserver:restart-${maven.webserver.fullname}"
|
||||
description="Restart the web server instance">
|
||||
prereqs="webserver:init"
|
||||
description="Restart a webserver instance">
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${context.getVariable('maven.webserver.started') == 'true'}">
|
||||
<webserver:restart />
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<ant:echo message=" ">
|
||||
--------------------------------------------------------------------------
|
||||
| Plugin Warning |
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Webserver not yet started
|
||||
|
||||
You may try
|
||||
o webserver:start
|
||||
o webserver:cycle
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
</ant:echo>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</goal>
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- S T O P -->
|
||||
<!--==================================================================-->
|
||||
<goal name="webserver:stop" prereqs="webserver:init"
|
||||
description="Stop a webserver instance if started">
|
||||
<webserver:stop />
|
||||
description="Stop a webserver instance">
|
||||
|
||||
<j:choose>
|
||||
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') == 'true'}">
|
||||
<webserver:stop />
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<log:info trim="false">
|
||||
==> Webserver already stopped!
|
||||
</log:info>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</goal>
|
||||
|
||||
|
||||
<!--==================================================================-->
|
||||
<!-- C L E A N -->
|
||||
<!--==================================================================-->
|
||||
@@ -432,9 +541,7 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
|
||||
<!-- started and installed -->
|
||||
<j:when test="${context.getVariable('maven.webserver.installedAndStarted') == 'true'}">
|
||||
<!-- FIXME - another candidate for attainGoal session -->
|
||||
<webserver:stop />
|
||||
|
||||
<webserver:clean />
|
||||
</j:when>
|
||||
|
||||
@@ -446,7 +553,7 @@ Maven has determined your <j:expr value="${maven.webserver.fullname}"/> webserve
|
||||
<!-- already cleaned -->
|
||||
<j:otherwise>
|
||||
<log:info trim="false">
|
||||
<j:expr value="${maven.webserver.fullname}"/>: Already cleaned!
|
||||
==> Webserver already cleaned!
|
||||
</log:info>
|
||||
</j:otherwise>
|
||||
|
||||
|
||||
Reference in new issue
Block a user