dev@glassfish.java.net

Re: [Ask/Help]About glassfish-jar packaging

From: Tang Yong <tangyong_at_cn.fujitsu.com>
Date: Thu, 25 Apr 2013 17:55:03 +0900

Hi Romain,

Excellent Reply!

> Among many ways to do that, my vote goes to
> glassfishbuild-maven-plugin:unpack-sources.
A litter question, if I donot want to unpack the wrapped source, and
only want to wrap its class file generated based on some version(The
scene is that the wrapped bundle does not export some packages, and I
want to has some visibility for these packages). So, could you please
give me a vote again?

Thanks
--Tang

Romain Grecourt wrote:
>
> glassfish-jar is a custom maven packaging which defines the following
> lifecycle:
>
>
> <generate-sources>org.glassfish.hk2:config-generator:generate-injectors</generate-sources>
>
> <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
>
> <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
> <process-classes>
>
> org.glassfish.hk2:osgiversion-maven-plugin:compute-osgi-version,
>
> org.glassfish.hk2:hk2-inhabitant-generator:generate-inhabitants,
> org.apache.felix:maven-bundle-plugin:manifest,
> org.glassfish.build:command-security-maven-plugin:check
> </process-classes>
>
> <generate-test-sources>org.glassfish.hk2:config-generator:generate-test-injectors</generate-test-sources>
>
> <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
>
> <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
>
> <process-test-classes>org.glassfish.hk2:hk2-inhabitant-generator:generate-test-inhabitants</process-test-classes>
>
> <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
>
> <package>org.apache.maven.plugins:maven-jar-plugin:jar</package>
>
> <install>org.apache.maven.plugins:maven-install-plugin:install</install>
>
> <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
>
> It does trigger the execution of bundle:manifest, not bundle:bundle.
> Hence, it does not repackage class files but just generates the OSGi
> metadata.
>
> If you want to repackage some classes you'll have to fit another plugin
> execution in your pom.xml.
>
> Among many ways to do that, my vote goes to
> glassfishbuild-maven-plugin:unpack-sources.
> This assumes that the corresponding sources.jar is available, it will
> unpack it and attached the unpacked sources to the maven-project to make
> them visible to all other plugins (e.g. maven-compiler and so on).
> The main advantage of this solution is that you recompile the sources
> and you are able to generate proper sources and javadoc jars.
>
> Thanks,
> Romain
>
> On 4/25/13 10:34 AM, Tang Yong wrote:
>> Hi Romain,
>> CC: Sahoo,
>>
>> I have a question about glassfish-jar packaging, The attachment is my
>> pom and osgi.bundle files.
>>
>> [Question]
>> I wish wrapping org.apache.felix.bundlerepository related class file
>> into my bundle jar.
>>
>> If I make packaging is bundle liking the following,
>>
>> <artifactId>glassfish-obr-builder</artifactId>
>> <version>4.0-SNAPSHOT</version>
>> <name>Builds OBR from a set of OSGi bundles</name>
>> <packaging>bundle</packaging>
>>
>> Then, wrapping is successful.
>>
>> However, once I make packaging is glassfish-jar, wrapping will failed
>> and org.apache.felix.bundlerepository related class file will be not
>> wrapped into my bundle jar.
>>
>> Whether for glassfish-jar, the feature is not supported? Or is there
>> something wrong with me?
>>
>> Thanks
>> --Tang
>

-- 
−−−−−−−−−−−−−−−−−−−−−−
Tang Yong
Senior Engineer
Glassfish Team Developer(OSGi&OSGi-JavaEE)
OSGi Alliance Supporter
Blog: http://osgizone.typepad.com/tangyong/
Nanjing Fujitsu NanDa Software Tec CO.,LTD
http://www.fujitsu.com/cn/fnst
Tel: +86-25-86630566-8310
Fax: +86-25-83317685              
−−−−−−−−−−−−−−−−−−−−−−