You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ah...@apache.org on 2005/09/12 17:34:42 UTC
svn commit: r280355 - in /maven/maven-1/plugins/trunk/plugin: plugin.jelly
xdocs/changes.xml xdocs/tags.xml
Author: aheritier
Date: Mon Sep 12 08:34:35 2005
New Revision: 280355
URL: http://svn.apache.org/viewcvs?rev=280355&view=rev
Log:
new plugin:available tag to check if a minimal release of a plugin is present.
Modified:
maven/maven-1/plugins/trunk/plugin/plugin.jelly
maven/maven-1/plugins/trunk/plugin/xdocs/changes.xml
maven/maven-1/plugins/trunk/plugin/xdocs/tags.xml
Modified: maven/maven-1/plugins/trunk/plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/plugin/plugin.jelly?rev=280355&r1=280354&r2=280355&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/plugin/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/plugin/plugin.jelly Mon Sep 12 08:34:35 2005
@@ -369,6 +369,67 @@
</ant:fileset>
</ant:delete>
</define:tag>
+
+ <define:tag name="available">
+ <!-- Check parameters -->
+ <maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified"/>
+ <maven:param-check value="${artifactId}" fail="true" message="'artifactId' must be specified"/>
+ <maven:param-check value="${minRelease}" fail="true" message="'minRelease' must be specified"/>
+
+ <j:set var="pluginToTest" value="${artifactId}"/>
+ <j:set var="minReleaseToHave" value="${minRelease}"/>
+
+ <maven:get plugin="${pluginToTest}" property="plugin" var="installedPlugin" />
+ <!-- Check if the plugin is installed -->
+ <j:choose>
+ <j:when test="${!empty(installedPlugin)}">
+ <j:set var="installedRelease" value="${installedPlugin.currentVersion}"/>
+ <!-- Remove SNAPSHOT -->
+ <u:replace var="installedRelease" escapeText="true" old="-SNAPSHOT" new="">${installedRelease}</u:replace>
+ <u:replace var="minReleaseToHave" escapeText="true" old="-SNAPSHOT" new="">${minReleaseToHave}</u:replace>
+ <!-- Tokenify -->
+ <u:tokenize var="installedReleaseTokens" delim="." escapeText="true">${installedRelease}</u:tokenize>
+ <u:tokenize var="minReleaseToHaveTokens" delim="." escapeText="true">${minReleaseToHave}</u:tokenize>
+ <j:set var="minReleaseToHaveTokensIter" value="${minReleaseToHaveTokens.iterator()}"/>
+
+ <j:forEach var="numberInstalled" items="${installedReleaseTokens}">
+ <j:if test="${!minReleaseToHaveTokens.iterator().hasNext()}">
+ <j:set var="testFailed" value="true"/>
+ <j:break/>
+ </j:if>
+ <j:set var="numberToHave" value="${minReleaseToHaveTokensIter.next()}"/>
+ <j:choose>
+ <j:when test="${numberInstalled.compareTo(numberToHave) lt 0}">
+ <!-- ${numberInstalled} is less than ${numberToHave} => fail -->
+ <j:set var="testFailed" value="true"/>
+ <j:break/>
+ </j:when>
+ <j:when test="${numberInstalled.compareTo(numberToHave) eq 0}">
+ <!-- ${numberInstalled} is equal than ${numberToHave} => continue to test -->
+ </j:when>
+ <j:when test="${numberInstalled.compareTo(numberToHave) gt 0}">
+ <!-- ${numberInstalled} is greater than ${numberToHave} => good -->
+ <j:break/>
+ </j:when>
+ </j:choose>
+ </j:forEach>
+ </j:when>
+ <j:otherwise>
+ <j:set var="testFailed" value="true"/>
+ </j:otherwise>
+ </j:choose>
+
+ <j:if test="${testFailed}">
+ <ant:fail>
+ - BE CAREFUL
+ =======================================================================================
+ Must have ${pluginToTest} plugin v${minReleaseToHave} installed to use this version of the plugin.
+ Try: maven plugin:download -DgroupId=maven -DartifactId=${pluginToTest} -Dversion=${minReleaseToHave}
+ =======================================================================================
+ </ant:fail>
+ </j:if>
+ </define:tag>
+
</define:taglib>
<define:taglib uri="assert">
Modified: maven/maven-1/plugins/trunk/plugin/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/plugin/xdocs/changes.xml?rev=280355&r1=280354&r2=280355&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/plugin/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/plugin/xdocs/changes.xml Mon Sep 12 08:34:35 2005
@@ -23,6 +23,9 @@
<author email="evenisse@ifrance.com">Emmanuel Venisse</author>
</properties>
<body>
+ <release version="1.7-SNAPSHOT" date="In SVN">
+ <action dev="aheritier" type="add">new plugin:available tag to check if a minimal release of a plugin is present.</action>
+ </release>
<release version="1.6" date="2005-06-03">
<action dev="vmassol" type="add">Added new
<code>assert:assertFileContains</code>tag that verifies if a file contains a specific string.
Modified: maven/maven-1/plugins/trunk/plugin/xdocs/tags.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/plugin/xdocs/tags.xml?rev=280355&r1=280354&r2=280355&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/plugin/xdocs/tags.xml (original)
+++ maven/maven-1/plugins/trunk/plugin/xdocs/tags.xml Mon Sep 12 08:34:35 2005
@@ -31,6 +31,7 @@
<ol>
<li><a href='#uninstall_Tag'>uninstall</a></li>
<li><a href='#clearCache_Tag'>clearCache</a></li>
+ <li><a href='#available_Tag'>available</a></li>
</ol>
</li>
<li><a href='#assert_Tag_Library'>assert</a>
@@ -69,6 +70,27 @@
tag libraries from <code>${maven.plugin.unpacked.dir}</code>
</p>
<p>There are no attributes for this tag</p>
+ </subsection>
+ <subsection name='assertFileExists Tag'>
+ <p>Fails the build if the given plugin does not exist or hasn't the minimal release number. Otherwise no effect.</p>
+ <table>
+ <tr><th>Attribute</th><th>Optional?</th><th>Description</th></tr>
+ <tr>
+ <td>groupId</td>
+ <td>No</td>
+ <td>The plugin's groupId</td>
+ </tr>
+ <tr>
+ <td>artifactId</td>
+ <td>No</td>
+ <td>The plugin's artifactId</td>
+ </tr>
+ <tr>
+ <td>minRelease</td>
+ <td>No</td>
+ <td>The minimum plugin's release</td>
+ </tr>
+ </table>
</subsection>
</section>
<section name='assert Tag Library'>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org