You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/10/28 14:56:19 UTC
svn commit: r1402995 - in
/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker:
AbstractInvokerMojo.java SelectorUtils.java
Author: rfscholte
Date: Sun Oct 28 13:56:19 2012
New Revision: 1402995
URL: http://svn.apache.org/viewvc?rev=1402995&view=rev
Log:
[MINVOKER-126] mavenHome in relationship with invoker.maven.version rule
Modified:
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/SelectorUtils.java
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java?rev=1402995&r1=1402994&r2=1402995&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java Sun Oct 28 13:56:19 2012
@@ -572,6 +572,11 @@ public abstract class AbstractInvokerMoj
* The format for elapsed build time.
*/
private final DecimalFormat secFormat = new DecimalFormat( "(0.0 s)", new DecimalFormatSymbols( Locale.ENGLISH ) );
+
+ /**
+ * The version of Maven which is used to run the builds
+ */
+ private String actualMavenVersion;
/**
* Invokes Maven on the configured test projects.
@@ -1101,8 +1106,16 @@ public abstract class AbstractInvokerMoj
}
final File finalSettingsFile = mergedSettingsFile;
- // @todo calculate MavenVersion, JavaVersion and OS here only once...
- // isSelected() retrieves these values for every BuildJob, but they are read over and over again inside SelectorUtils
+ // @todo calculate JavaVersion and OS here only once...
+ // isSelected() retrieves these values for every BuildJob, but they are read over and over again inside SelectorUtils
+ if ( mavenHome != null )
+ {
+ actualMavenVersion = SelectorUtils.getMavenVersion( mavenHome );
+ }
+ else
+ {
+ actualMavenVersion = SelectorUtils.getMavenVersion();
+ }
try
{
@@ -1305,7 +1318,7 @@ public abstract class AbstractInvokerMoj
*/
private boolean isSelected( InvokerProperties invokerProperties )
{
- if ( !SelectorUtils.isMavenVersion( invokerProperties.getMavenVersion() ) )
+ if ( !SelectorUtils.isMavenVersion( invokerProperties.getMavenVersion(), actualMavenVersion ) )
{
return false;
}
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/SelectorUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/SelectorUtils.java?rev=1402995&r1=1402994&r2=1402995&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/SelectorUtils.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/SelectorUtils.java Sun Oct 28 13:56:19 2012
@@ -155,11 +155,16 @@ class SelectorUtils
static boolean isMavenVersion( String mavenSpec )
{
+ return isMavenVersion( mavenSpec, getMavenVersion() );
+ }
+
+ static boolean isMavenVersion( String mavenSpec, String actualVersion )
+ {
List<String> includes = new ArrayList<String>();
List<String> excludes = new ArrayList<String>();
parseList( mavenSpec, includes, excludes );
- List<Integer> mavenVersionList = parseVersion( getMavenVersion() );
+ List<Integer> mavenVersionList = parseVersion( actualVersion );
return isJreVersion( mavenVersionList, includes, true ) && !isJreVersion( mavenVersionList, excludes, false );
}