Don't check that a given plugin version is available in the bootstrap.

Replace tabs with spaces

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@496537 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier
2007-01-15 23:35:18 +00:00
parent 93d8bfa6c6
commit feb031d22c
2 changed files with 101 additions and 86 deletions

View File

@@ -108,74 +108,75 @@
</define:tag>
<define:tag name="assertPluginAvailable">
<!-- 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"/>
<maven:param-check value="${neededBy}" fail="true" message="'neededBy' must be specified"/>
<j:set var="pluginToTest" value="${artifactId}"/>
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${minRelease.endsWith('-SNAPSHOT')}">
<j:invokeStatic className="org.apache.commons.lang.StringUtils" method="substringBeforeLast" var="minReleaseToHave">
<j:if test="${bootstrapping == null}">
<!-- 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"/>
<maven:param-check value="${neededBy}" fail="true" message="'neededBy' must be specified"/>
<j:set var="pluginToTest" value="${artifactId}"/>
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${minRelease.endsWith('-SNAPSHOT')}">
<j:invokeStatic className="org.apache.commons.lang.StringUtils" method="substringBeforeLast" var="minReleaseToHave">
<j:arg value="${minRelease}" type="java.lang.String"/>
<j:arg value="-SNAPSHOT" type="java.lang.String"/>
</j:invokeStatic>
</j:when>
<j:otherwise>
<j:set var="minReleaseToHave" value="${minRelease}"/>
</j:otherwise>
</j:choose>
<!-- A workaround to force maven to load the plugin if it's not already done -->
<maven:set plugin="${pluginToTest}" property="myFakePropertyUsedToLoadThePlugin" value="XXXX" />
<!-- maven:get don't want to do it -->
<maven:get plugin="${pluginToTest}" property="plugin" var="installedPlugin" />
<!-- Check if the plugin is installed -->
<j:choose>
<j:when test="${!empty(installedPlugin)}">
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${installedPlugin.currentVersion.endsWith('-SNAPSHOT')}">
<j:invokeStatic className="org.apache.commons.lang.StringUtils" method="substringBeforeLast" var="installedRelease">
</j:invokeStatic>
</j:when>
<j:otherwise>
<j:set var="minReleaseToHave" value="${minRelease}"/>
</j:otherwise>
</j:choose>
<!-- A workaround to force maven to load the plugin if it's not already done -->
<maven:set plugin="${pluginToTest}" property="myFakePropertyUsedToLoadThePlugin" value="XXXX" />
<!-- maven:get don't want to do it -->
<maven:get plugin="${pluginToTest}" property="plugin" var="installedPlugin" />
<!-- Check if the plugin is installed -->
<j:choose>
<j:when test="${!empty(installedPlugin)}">
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${installedPlugin.currentVersion.endsWith('-SNAPSHOT')}">
<j:invokeStatic className="org.apache.commons.lang.StringUtils" method="substringBeforeLast" var="installedRelease">
<j:arg value="${installedPlugin.currentVersion}" type="java.lang.String"/>
<j:arg value="-SNAPSHOT" type="java.lang.String"/>
</j:invokeStatic>
</j:when>
<j:otherwise>
<j:set var="installedRelease" value="${installedPlugin.currentVersion}"/>
</j:otherwise>
</j:choose>
<j:set var="testOk" value="false"/>
<j:set var="testFailed" value="false"/>
<!-- Test strings comparaison -->
<j:choose>
<j:when test="${!installedRelease.equals(minReleaseToHave)}">
<!-- If not equals we use a more complex algorithm -->
<!-- Tokenify -->
<u:tokenize var="installedReleaseTokens" delim=".">${installedRelease}</u:tokenize>
<u:tokenize var="minReleaseToHaveTokens" delim=".">${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:invokeStatic var="numberInstalledInteger" className="java.lang.Integer" method="valueOf">
<j:arg value="${numberInstalled}"/>
</j:invokeStatic>
<j:invokeStatic var="numberToHaveInteger" className="java.lang.Integer" method="valueOf">
<j:arg value="${numberToHave}"/>
</j:invokeStatic>
<j:choose>
</j:when>
<j:otherwise>
<j:set var="installedRelease" value="${installedPlugin.currentVersion}"/>
</j:otherwise>
</j:choose>
<j:set var="testOk" value="false"/>
<j:set var="testFailed" value="false"/>
<!-- Test strings comparaison -->
<j:choose>
<j:when test="${!installedRelease.equals(minReleaseToHave)}">
<!-- If not equals we use a more complex algorithm -->
<!-- Tokenify -->
<u:tokenize var="installedReleaseTokens" delim=".">${installedRelease}</u:tokenize>
<u:tokenize var="minReleaseToHaveTokens" delim=".">${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:invokeStatic var="numberInstalledInteger" className="java.lang.Integer" method="valueOf">
<j:arg value="${numberInstalled}"/>
</j:invokeStatic>
<j:invokeStatic var="numberToHaveInteger" className="java.lang.Integer" method="valueOf">
<j:arg value="${numberToHave}"/>
</j:invokeStatic>
<j:choose>
<j:when test="${numberInstalledInteger.compareTo(numberToHaveInteger) lt 0}">
<j:set var="errorSentence" value="Currently the plugin ${pluginToTest} v${installedRelease} is installed."/>
<j:set var="testFailed" value="true"/>
@@ -187,35 +188,48 @@
<j:set var="testOk" value="true"/>
<j:break/>
</j:when>
</j:choose>
</j:forEach>
</j:when>
<j:otherwise>
<j:set var="testOk" value="true"/>
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<j:set var="errorSentence" value="Currently the plugin ${pluginToTest} isn't installed."/>
<j:set var="testFailed" value="true"/>
</j:otherwise>
</j:choose>
<j:if test="${!testFailed and !testOk and minReleaseToHaveTokens.iterator().hasNext()}">
<!-- A minor release is missing. For example : 1.10 < 1.10.2 -->
<j:set var="errorSentence" value="Currently the plugin ${pluginToTest} v${installedRelease} is installed."/>
<j:set var="testFailed" value="true"/>
</j:if>
<j:if test="${testFailed}">
<ant:fail>
</j:choose>
</j:forEach>
</j:when>
<j:otherwise>
<j:set var="testOk" value="true"/>
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<j:set var="errorSentence" value="Currently the plugin ${pluginToTest} isn't installed."/>
<j:set var="testFailed" value="true"/>
</j:otherwise>
</j:choose>
<j:if test="${!testFailed and !testOk and minReleaseToHaveTokens.iterator().hasNext()}">
<!-- A minor release is missing. For example : 1.10 < 1.10.2 -->
<j:set var="errorSentence" value="Currently the plugin ${pluginToTest} v${installedRelease} is installed."/>
<j:set var="testFailed" value="true"/>
</j:if>
<j:if test="${testFailed}">
<ant:fail>
-
===============================================================================
Must have the plugin ${pluginToTest} v${minReleaseToHave} installed to use this version of ${neededBy}.
${errorSentence}
Try: maven plugin:download -DgroupId=maven -DartifactId=${pluginToTest} -Dversion=${minReleaseToHave}
===============================================================================
</ant:fail>
</ant:fail>
</j:if>
</j:if>
<j:if test="${bootstrapping != null}">
<ant:echo>
-
===============================================================================
BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP
===============================================================================
Can't check that you have the plugin ${pluginToTest} v${minReleaseToHave} required by ${neededBy}.
===============================================================================
BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP BOOTSTRAP
===============================================================================
</ant:echo>
</j:if>
</define:tag>

View File

@@ -24,6 +24,7 @@
</properties>
<body>
<release version="1.8-SNAPSHOT" date="In SVN">
<action dev="aheritier" type="update">Don't check that a given plugin version is available in the bootstrap.</p>
<action dev="aheritier" type="update">Update dependencies to unify them between plugins. The following dependencies are updated : commons-jelly-tags-interaction v1.0 to v1.1, jaxen v1.0-FCS-full to 1.1-beta-9. The following dependencies are removed : saxpath.</action>
<action dev="aheritier" type="update" issue="MAVEN-1753">Upgrade to Xerces 2.8.0. Replace the deprecated xmlParserAPIs by xml-apis 1.3.03. Add the xml-resolver dependency for xerces.</action>
</release>