felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1030211 - /felix/trunk/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
Date Tue, 02 Nov 2010 20:54:00 GMT
Author: fmeschbe
Date: Tue Nov  2 20:54:00 2010
New Revision: 1030211

URL: http://svn.apache.org/viewvc?rev=1030211&view=rev
Log:
FELIX-2681 Just us the Artifact.getBaseVersion() to compare the version
of the actual artifact with the minium version. Should not bother with
getSelectedVersion()

Modified:
    felix/trunk/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java

Modified: felix/trunk/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java?rev=1030211&r1=1030210&r2=1030211&view=diff
==============================================================================
--- felix/trunk/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
(original)
+++ felix/trunk/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
Tue Nov  2 20:54:00 2010
@@ -28,7 +28,6 @@ import org.apache.felix.scrplugin.*;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.*;
 import org.apache.maven.project.MavenProject;
@@ -243,24 +242,14 @@ public class SCRDescriptorMojo extends A
     {
         if (SCR_ANN_ARTIFACTID.equals(a.getArtifactId()) && SCR_ANN_GROUPID.equals(a.getGroupId()))
         {
-            // compare version number
-            try
+            // assert minimal version number
+            ArtifactVersion aVersion = new DefaultArtifactVersion(a.getBaseVersion());
+            if (SCR_ANN_MIN_VERSION.compareTo(aVersion) > 0)
             {
-                ArtifactVersion aVersion = a.getSelectedVersion();
-                if (SCR_ANN_MIN_VERSION.compareTo(aVersion) > 0)
-                {
-                    getLog().error("Project depends on " + a);
-                    getLog().error("Minimum required version is " + SCR_ANN_MIN_VERSION);
-                    throw new MojoFailureException(
-                        "Please use org.apache.felix:org.apache.felix.scr.annotations version
" + SCR_ANN_MIN_VERSION
-                            + " or newer.");
-                }
-            }
-            catch (OverConstrainedVersionException oe)
-            {
-                getLog().error(oe.toString());
-                getLog().debug(oe);
-                throw new MojoFailureException(oe.getMessage());
+                getLog().error("Project depends on " + a);
+                getLog().error("Minimum required version is " + SCR_ANN_MIN_VERSION);
+                throw new MojoFailureException("Please use org.apache.felix:org.apache.felix.scr.annotations
version "
+                    + SCR_ANN_MIN_VERSION + " or newer.");
             }
         }
     }



Mime
View raw message