plugin.currentVersion

inside the plugin, just like that. Outside, use in conjunction with maven:get

Quoting Eric Pugh <[EMAIL PROTECTED]>:

> Hi all,
> 
> I have a report that runs that checks a plugin to see if there are newer
> versions, and if so, tells the user.  I then saw the plugin-profile.xml
> stuff in the main maven build, and thought that I could scroll through a
> plugin profile to verify that I have all the plugins needed for a specific
> project.
> 
> This works sorta okay..  Right now, I can do a comparison between a version
> specified in the plugin:profile , but I can't seem to look up the
> corresponding plugin for my project and get it's currentVersion.
> 
> Here are three failed attempts:
>     <maven:pluginVar var="testPlugin" plugin='maven-test-plugin'
> property='currentVersion' />
>       <echo message="version
> ${testPlugin.getDependency('junit').getVersion()}"/>
>       <echo message="version2
> ${pom.getPluginContext('maven-ant-plugin').getVariable('currentVersion')}"/>
>       <echo message="version3
> ${pom.getPlugin('maven-ant-plugin').currentVersion}"/>
> 
> Below is the full goal I am running.  anyone have any pointers on how to get
> the project for a plugin and lookup it's currentVersion?  It seems to me
> that I should be doing something with the pluginContext, but I can't seem to
> hit the right incantation.
> 
> Eric
> 
> 
> 
> <goal name="test-latestversion-all">
> 
>    <define:taglib uri="latestversion">
>       <define:jellybean
>           name="latestversion"
>           className="com.anite.latestversion.LatestVersion"
>           method="doExecute"
>         />
>    </define:taglib>
> 
>      <mkdir dir="${maven.build.dir}/lastestversion/"/>
>     <x:parse var="plugins"
> xml="http://maven.aniteps.com/docs/plugin-profile.xml"; />
>     <x:forEach var="plugin" select="$plugins/plugins/plugin">
>       <j:set var="groupId"><x:expr select="@groupId" /></j:set>
>       <j:set var="artifactId"><x:expr select="@artifactId" /></j:set>
>       <j:set var="version"><x:expr select="@version" /></j:set>
>       <maven:pluginVar var="testPlugin" plugin='maven-test-plugin'
> property='currentVersion' />
>       <echo message="version
> ${testPlugin.getDependency('junit').getVersion()}"/>
>       <echo message="version2
> ${pom.getPluginContext('maven-ant-plugin').getVariable('currentVersion')}"/>
>       <echo message="version3
> ${pom.getPlugin('maven-ant-plugin').currentVersion}"/>
> 
>       <ant:echo>Testing ${groupId}:${artifactId} version
> ${version}</ant:echo>
> 
> <latestversion:latestversion
>             var="lv"
>             project="${pom}"
>             basedir="${maven.docs.dest}"
>             groupId="${groupId}"
>             artifactId="${artifactId}"
>             artifactType="plugin"
>             currentVersion="${version}"
>             output="${maven.build.dir}/lastestversion/latestversion-results.xml"
>             outputEncoding="${maven.docs.outputencoding}"
>             />
>         <j:set var="newerVersionsAsString"
> value="${lv.newerVersionsAsString}"/>
>         <j:if test="${!empty(newerVersionsAsString)}">
>                       <j:set var="anite.latestversion.result" value="true"/>
>         <ant:fail>
> WARNING:  There is a newer version (${lv.newerVersionsAsString}) of the
> ${artifactId} for Maven
> available.  You are currently running version ${version}.
> 
> Please download and install it by running:
> 
> maven
> plugin:download -DgroupId=${groupId} -DartifactId=${artifactId} -Dversion=${
> lv.newerVersionsAsString}
> 
>         </ant:fail>
>       </j:if>
>       <j:if test="${empty(newerVersionsAsString)}">
>         <j:set var="anite.latestversion.result" value="false"/>
>         <ant:echo message="No newer version of plugin found"/>
>       </j:if>
> 
>     </x:forEach>
> 
>   </goal>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to