Initial commit of new caller plugin. The caller plugin is useful to isolate a plugin from other plugins it calls so that different implementation can be seamlessly introduced.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol
2003-09-29 13:08:58 +00:00
parent b3eb48b609
commit 819465bc2e
10 changed files with 247 additions and 0 deletions

5
caller/.cvsignore Normal file
View File

@@ -0,0 +1,5 @@
target
maven.log
velocity.log
.classpath
.project

39
caller/plugin.jelly Normal file
View File

@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define">
<define:taglib uri="caller">
<!-- Example of usage:
<caller:call goalInterface="compile-java"/>
-->
<define:tag name="call">
<j:set var="callProperty" value="maven.caller.call.${goalInterface}"/>
<!-- Search first in the caller's context -->
<j:set var="goalName"
value="${context.findVariable(callProperty)}"/>
<j:if test="${goalName == null}">
<!-- Search in this plugin context -->
<j:set var="goalName"
value="${pom.getPluginContext('maven-caller-plugin').findVariable(callProperty)}"/>
</j:if>
<j:if test="${goalName == null}">
<ant:fail message="Property [maven.caller.call.${goalInterface}] is not defined"/>
</j:if>
<attainGoal name="${goalName}"/>
</define:tag>
<!-- Example of usage:
<caller:set goalInterface="compile-java" goal="aspectj:compile"/>
-->
<define:tag name="set">
<j:set var="setProperty" value="maven.caller.call.${goalInterface}"/>
<j:set var="${setProperty}" value="${goal}"/>
</define:tag>
</define:taglib>
</project>

8
caller/plugin.properties Normal file
View File

@@ -0,0 +1,8 @@
# List of Well-Known Goal Interface (WKGI).
#
# compile-java : compile the source code in ${maven.compile.src.set} (i.e. the
# sources in ${pom.build.sourceDirectory}).
# Default implementation goals for the WKGIs
maven.caller.call.compile-java = java:compile

View File

@@ -0,0 +1,7 @@
# -------------------------------------------------------------------
# P R O J E C T P R O P E R T I E S
# -------------------------------------------------------------------
maven.xdoc.date=left
maven.xdoc.version=${pom.currentVersion}
maven.license.licenseFile=${basedir}/../../../LICENSE.txt

31
caller/project.xml Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<extend>../project.xml</extend>
<pomVersion>3</pomVersion>
<id>maven-caller-plugin</id>
<name>Maven Caller Plugin</name>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<description>Interface to isolate calls between plugins</description>
<shortDescription>Maven Caller plugin</shortDescription>
<url>http://maven.apache.org/reference/plugins/caller/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/caller/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/caller/</connection>
<url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/caller/</url>
</repository>
<developers>
<developer>
<name>Vincent Massol</name>
<id>vmassol</id>
<email>vmassol@pivolis.com</email>
<organization>Pivolis</organization>
<roles>
<role>Creator</role>
<role>Developer</role>
<role>Release Manager</role>
</roles>
</developer>
</developers>
<dependencies/>
</project>

17
caller/xdocs/changes.xml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Caller Plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<release version="1.0" date="in CVS">
<action dev="vmassol" type="add">
Initial creation of plugin.
</action>
</release>
</body>
</document>

34
caller/xdocs/goals.xml Normal file
View File

@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Caller plugin goals</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Goals">
<table>
<tr><th>Goal</th><th>Description</th></tr>
<tr>
<td>call</td>
<td>
Call a Well-Known Goal Interface (WKGI). For example
<code>&lt;caller:call goalInterface="compile-java"/&gt;</code>.
The list of WKGIs are found on the
<a href="properties.html">properties page</a>.
</td>
</tr>
<tr>
<td>set</td>
<td>
Rewire a WKGI implementation. For example
<code>&lt;caller:set goalInterface="compile-java" goal="aspectj:compile"/&gt;</code>.
You can also directly set the corresponding Maven property:
<code>maven.caller.call.[WKGI name]</code>.
</td>
</tr>
</table>
</section>
</body>
</document>

61
caller/xdocs/index.xml Normal file
View File

@@ -0,0 +1,61 @@
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Caller plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Maven Caller Plug-in">
<p>
The Caller plugin is an interface abstraction for goals. It defines
several Well-Known Goal Interfaces (WKGI). This allows a plugin
to call another plugin through this Caller plugin. The benefit is
that it is then possible to rewire the implementation of a WKGI.
</p>
<p>
Here's a typical scenario. Imagine you wish to implement an aspectj
plugin. This plugin will compile the Java sources using the Aspectj
compiler. However, the project you wish to use the aspectj plugin on
is a webapp and thus you will need call the <code>war:war</code>.
Alas, the <code>war:war</code> goal has a hard-wired call to
<code>java:compile</code>. What you would like is redirect this call
to your <code>aspectj:compile</code> goal. The solution: the Caller
plugin.
</p>
<p>
Here's what you would write. In the war plugin's
<code>plugin.jelly</code>, you would replace the call to
</p>
<source><![CDATA[
<attainGoal name="java:compile"/>
]]></source>
<p>
by
</p>
<source><![CDATA[
<caller:call goalInterface="compile-java"/>
]]></source>
<p>
Then, in your Aspectj plugin, you would call
</p>
<source><![CDATA[
<caller:set goalInterface="compile-java" goal="aspectj:compile"/>
]]></source>
<p>
Thus, when, as a user you will call the <code>war:war</code>
goal, your <code>aspectj:compile</code> goal will be called.
</p>
<p>
For more information on the functionality provided by this plugin,
please see the <a href="goals.html">Goals</a> document.
</p>
<p>
For more information on how to customise the functionality provided
by this plugin, please see the <a href="properties.html">properties</a>
document.
</p>
</section>
</body>
</document>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Maven Caller Plugin">
<title>Maven Caller Plugin</title>
<author email="vmassol@apache.org">Vincent Massol</author>
<body>
<links>
<item name="Maven" href="http://maven.apache.org/"/>
</links>
<menu name="Overview">
<item name="Goals" href="/goals.html" />
<item name="Properties" href="/properties.html" />
</menu>
</body>
</project>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Maven Caller plugin properties</title>
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<section name="Maven Caller plugin settings">
<table>
<tr>
<th>Property name</th>
<th>Optional?</th>
<th>Description</th>
</tr>
<tr>
<td>maven.caller.call.compile-java</td>
<td>Yes</td>
<td>
Defines the implementing goal for the "compile-java" WKGI.
The default value is <code>java:compile</code>.
</td>
</tr>
</table>
</section>
</body>
</document>