[ 
https://issues.apache.org/jira/browse/FELIX-636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614009#action_12614009
 ] 

Stuart McCulloch commented on FELIX-636:
----------------------------------------

This is working as designed - by default we use the Maven2OsgiConverter 
provided by the Maven team to convert the groupId and artifactId combination to 
a unique Bundle-SymbolicName, and only fall back to use "groupId.artifactId" as 
a last resort. This gives us the best compatibility with other Maven plugins 
that use the same (shared) component:

   
http://svn.apache.org/repos/asf/maven/shared/tags/maven-osgi-0.2.0/src/main/java/org/apache/maven/shared/osgi/DefaultMaven2OsgiConverter.java

The Maven2OsgiConverter component uses the following algorithm to compute the 
symbolic name:

    /**
     * Get the symbolic name as groupId + "." + artifactId, with the following 
exceptions
     * <ul>
     * <li>if artifact.getFile is not null and the jar contains a OSGi Manifest 
with
     * Bundle-SymbolicName property then that value is returned</li>
     * <li>if groupId has only one section (no dots) and artifact.getFile is 
not null then the
     * first package name with classes is returned. eg. 
commons-logging:commons-logging ->
     * org.apache.commons.logging</li>
     * <li>if artifactId is equal to last section of groupId then groupId is 
returned. eg.
     * 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>
     * </ul>
     */

If you want to force the bundleplugin to always use "groupId.artifactId" as the 
symbolic name then just use:

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>1.4.1</version>
        <configuration>
          <instructions>
            
<Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
            <!-- etc... -->
          </instructions>
        </configuration>
      </plugin>

and this will override the default setting.

> Bundle-SymbolicName is generated incorrectly
> --------------------------------------------
>
>                 Key: FELIX-636
>                 URL: https://issues.apache.org/jira/browse/FELIX-636
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-1.4.1
>         Environment: Ubuntu
>            Reporter: Ken Paulsen
>         Attachments: pom.xml
>
>
> I have the following in the pom.xml:
>   <groupId>org.glassfish.jsftemplating</groupId>
>   <artifactId>jsftemplating</artifactId>
> After I build, I get the following in the MANIFEST.MF:
>    Bundle-SymbolicName: org.glassfish.jsftemplating
> Notice it only has 1 "jsftemplating" in the symbolic name.  If I change the 
> artifactId to something else and make no other changes, I get the expected 
> results.  For example, if I put this in the pom.xml:
>   <groupId>org.glassfish.jsftemplating</groupId>
>   <artifactId>jsft</artifactId>
> I get this in the MANIFEST.MF:
>    Bundle-SymbolicName: org.glassfish.jsftemplating.jsft
> Notice now both the full groupId AND artifact id appear in the symbolic name. 
>  This is what I expected to see. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to