felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r1342631 - in /felix/trunk/bundleplugin/src: main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java
Date Fri, 25 May 2012 14:18:02 GMT
Author: mcculls
Date: Fri May 25 14:18:01 2012
New Revision: 1342631

URL: http://svn.apache.org/viewvc?rev=1342631&view=rev
Log:
FELIX-3520: allow groupId to be a prefix of the artifactId without repetition when computing
Bundle-SymbolicName

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
    felix/trunk/bundleplugin/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java?rev=1342631&r1=1342630&r2=1342631&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java
Fri May 25 14:18:01 2012
@@ -68,6 +68,8 @@ public class DefaultMaven2OsgiConverter 
      * org.apache.maven:maven -> org.apache.maven</li>
      * <li>if artifactId starts with last section of groupId that portion is removed.
eg.
      * org.apache.maven:maven-core -> org.apache.maven.core</li>
+     * <li>if artifactId starts with groupId then the artifactId is removed. eg.
+     * org.apache:org.apache.maven.core -> org.apache.maven.core</li>
      * </ul>
      */
     public String getBundleSymbolicName( Artifact artifact )
@@ -128,6 +130,11 @@ public class DefaultMaven2OsgiConverter 
         {
             return artifact.getGroupId();
         }
+        if ( artifact.getArtifactId().equals( artifact.getGroupId() )
+            || artifact.getArtifactId().startsWith( artifact.getGroupId() + "." ) )
+        {
+            return artifact.getArtifactId();
+        }
         if ( artifact.getArtifactId().startsWith( lastSection ) )
         {
             String artifactId = artifact.getArtifactId().substring( lastSection.length()
);

Modified: felix/trunk/bundleplugin/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java?rev=1342631&r1=1342630&r2=1342631&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java
(original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/maven/shared/osgi/Maven2OsgiConverterTest.java
Fri May 25 14:18:01 2012
@@ -51,6 +51,11 @@ public class Maven2OsgiConverterTest
         s = maven2Osgi.getBundleSymbolicName( artifact );
         assertEquals( "org.apache.commons.commons-logging", s );
 
+        artifact.setGroupId( "org.apache" );
+        artifact.setArtifactId( "org.apache.commons-logging" );
+        s = maven2Osgi.getBundleSymbolicName( artifact );
+        assertEquals( "org.apache.commons-logging", s );
+
         artifact.setFile( getTestFile( "junit-3.8.2.jar" ) );
         artifact.setGroupId( "junit" );
         artifact.setArtifactId( "junit" );



Mime
View raw message