[ 
http://jira.codehaus.org/browse/MSOURCES-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=173554#action_173554
 ] 

Don Laidlaw commented on MSOURCES-41:
-------------------------------------

MSOURCES-42 almost does the trick. This type of thing works:

{code}<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1-SNAPSHOT</version>
        <executions>
                <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                                <goal>jar</goal>
                        </goals>
                </execution>
        </executions>
        <configuration>
                <archive>
                        <manifestEntries>
                                
<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                                <Bundle-Name>${name}</Bundle-Name>
                                
<Bundle-SymbolicName>${artifactId}.source</Bundle-SymbolicName>
                                
<Bundle-Vendor>${organization.name}</Bundle-Vendor>
                                <Bundle-Version>1.0.0.SNAPSHOT</Bundle-Version>
                                
<Eclipse-SourceBundle>${artifactId};version="1.0.0.SNAPSHOT";roots:="."</Eclipse-SourceBundle>
                        </manifestEntries>
                </archive>
        </configuration>
</plugin>
{code}

There is only one problem really. When we create OSGi bundle jars the 
maven-bundle-plugin automatically converts the maven pom version into an 
OSGi-compatible version. For instance: 1.0.0-SNAPSHOT becomes 1.0.0.SNAPSHOT. 
In general the bundle plugin replaces the '-' character with a dot.

When generating the manifest for the Eclipse source bundle, the version must 
match. It would be extremely convenient to generate the version in exactly the 
same way as the maven bundle plugin (by replacing the '-' with '.') so that the 
configuration for the source bundle generation could be parameterized. That way 
a parent project could specify the format for all the child projects.

So while it is possible to just specify the version number directly in the 
manifest settings as above, it would be a real pain to keep that in sync with 
the pom version. 

Any thoughts on how to accomplish this??

> Generate source jars supporting Eclipse Source Bundle format.
> -------------------------------------------------------------
>
>                 Key: MSOURCES-41
>                 URL: http://jira.codehaus.org/browse/MSOURCES-41
>             Project: Maven 2.x Source Plugin
>          Issue Type: New Feature
>    Affects Versions: 2.0.4
>         Environment: Eclipse 3.3+
>            Reporter: Don Laidlaw
>
> When developing eclipse plugins, or any OSGi bundle, it is desirable to 
> create the source attachments for a project as Eclipse Source Bundles. See 
> http://wiki.eclipse.org/Source_Bundles
> A source bundle appears in the target platform (the bundles in the runtime) 
> and allows the user to step into the source in debug, view the source, and 
> see the javadoc from the source. All without having to download the source 
> project. Source bundles differ from source attachments in non OSGi projects 
> in that they are part of the target platform, which is resolved dynamically 
> at runtime, not at compile time with the classpath.
> It is very easy to extend the maven source plugin to create these source 
> bundles. They are identical to the currently generated jar, with the addition 
> of a few entries in the META-INF/MANIFEST.MF file. So source jars usable as 
> source bundles are also 100% compatible with what is currently generated.
> I have already done the work and would be happy to contribute this back if 
> there is any interest.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to