Author: dkulp
Date: Mon Jun  9 15:49:03 2014
New Revision: 1601413

URL: http://svn.apache.org/r1601413
Log:
Add more checks for artifacts that aren't bundles.  Should allow plugin to be 
fully defined in parent pom.

Modified:
    aries/trunk/versioning/versioning-plugin/pom.xml
    
aries/trunk/versioning/versioning-plugin/src/main/java/org/apache/aries/versioning/mojo/VersionCheckerMojo.java

Modified: aries/trunk/versioning/versioning-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-plugin/pom.xml?rev=1601413&r1=1601412&r2=1601413&view=diff
==============================================================================
--- aries/trunk/versioning/versioning-plugin/pom.xml (original)
+++ aries/trunk/versioning/versioning-plugin/pom.xml Mon Jun  9 15:49:03 2014
@@ -23,14 +23,14 @@
 
     <parent>
         <groupId>org.apache.aries</groupId>
-        <artifactId>parent</artifactId>
-        <version>1.0.1-SNAPSHOT</version>
-        <relativePath>../../parent/pom.xml</relativePath>
+        <artifactId>java5-parent</artifactId>
+        <version>1.0.0</version>
+        <relativePath />
     </parent>
 
     <groupId>org.apache.aries.versioning</groupId>
     <artifactId>org.apache.aries.versioning.plugin</artifactId>
-    <version>0.2.1-SNAPSHOT</version>
+    <version>0.3.0-SNAPSHOT</version>
     <packaging>maven-plugin</packaging>
     <name>org.apache.aries.versioning.plugin Maven Mojo</name>
 
@@ -44,7 +44,7 @@
         <dependency>
             <groupId>org.apache.aries.versioning</groupId>
             <artifactId>org.apache.aries.versioning.checker</artifactId>
-            <version>0.2.1-SNAPSHOT</version>
+            <version>0.2.0</version>
         </dependency>
         <dependency>
             <groupId>org.ow2.asm</groupId>
@@ -86,7 +86,6 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>3.8.1</version>
             <scope>test</scope>
         </dependency>
 
@@ -113,7 +112,7 @@
         <plugins>
             <plugin>
                 <artifactId>maven-plugin-plugin</artifactId>
-                <version>3.2</version>
+                <version>3.3</version>
                 <configuration>
                     <goalPrefix>asv</goalPrefix>
                     
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>

Modified: 
aries/trunk/versioning/versioning-plugin/src/main/java/org/apache/aries/versioning/mojo/VersionCheckerMojo.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/versioning/versioning-plugin/src/main/java/org/apache/aries/versioning/mojo/VersionCheckerMojo.java?rev=1601413&r1=1601412&r2=1601413&view=diff
==============================================================================
--- 
aries/trunk/versioning/versioning-plugin/src/main/java/org/apache/aries/versioning/mojo/VersionCheckerMojo.java
 (original)
+++ 
aries/trunk/versioning/versioning-plugin/src/main/java/org/apache/aries/versioning/mojo/VersionCheckerMojo.java
 Mon Jun  9 15:49:03 2014
@@ -39,6 +39,7 @@ import org.apache.maven.plugins.annotati
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.repository.RepositorySystem;
+import org.osgi.framework.Version;
 
 /**
  * Check semantic version changes between an explicitly named old artifact and
@@ -59,9 +60,9 @@ public class VersionCheckerMojo extends 
     private boolean skip;
 
     /**
-     * Location of the file.
+     * Location of the file (defaults to main project artifact).
      */
-    @Parameter(required = true, defaultValue = 
"${project.build.directory}/${project.build.finalName}.jar")
+    @Parameter
     private File newFile;
 
     /**
@@ -92,10 +93,21 @@ public class VersionCheckerMojo extends 
         if ("pom".equals(project.getPackaging())) {
             return;
         }
+        if (newFile == null) {
+            newFile = project.getArtifact().getFile();
+        }
         if (oldArtifact != null) {
             try {
-                BundleInfo oldBundle = getBundleInfo(resolve(oldArtifact));
                 BundleInfo newBundle = getBundleInfo(newFile);
+                if (null == newBundle.getBundleManifest().getManifestVersion()
+                    && null == newBundle.getBundleManifest().getSymbolicName()
+                    && 
Version.emptyVersion.equals(newBundle.getBundleManifest().getVersion())) {
+                    //not a bundle type, just return
+                    getLog().info(newFile + " is not an OSGi bundle, 
skipping.");
+                    return;
+                }
+
+                BundleInfo oldBundle = getBundleInfo(resolve(oldArtifact));
                 String bundleSymbolicName = 
newBundle.getBundleManifest().getSymbolicName();
                 URLClassLoader oldClassLoader = new URLClassLoader(new URL[] 
{oldBundle.getBundle().toURI()
                     .toURL()});


Reply via email to