felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Lenzi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-336) Add support for optimization and obfuscation of bundle contents
Date Wed, 19 Mar 2008 06:18:24 GMT

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

Stefano Lenzi commented on FELIX-336:
-------------------------------------

I have just made some testes on "how-to use maven-bundle-plugin with minijar-maven-plugin",
and I don't think that they can seamless cooperate (at least at the moment). To perform my
tests I have added the following XML to my POM inside the /build/plugins XML part:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>minijar-maven-plugin</artifactId>
        <version>1..0-alpha-3</version>
	<executions>
	  <execution>
	    <id>ueberjar</id>
	    <phase>package</phase>
	    <goals><goal>ueberjar</goal></goals>
            <configuration>
	      <stripUnusedClasses>true</stripUnusedClasses>
	      <includeDependencies>
	        <param>none:dependency</param>
	      </includeDependencies>
            </configuration>
	  </execution>
	</executions>
      </plugin>

The idea behind the setup was that I use maven-bundle-plugin to build my "jar-with-dependencies",
then I use the minijar-maven-plugin to strip out the unused classes. 
 1 - You must add the includeDependencies configuration to force minijar to perform only the
stripping operation on the bundle generated by the maven-bundle-plugin. If you remove includeDependencies
configuration minijar will strip a jar containing either the bundle plus all the compile and
runtime scoped dependencies
 2 - We the current setup minijar can not handle pom genereting classified bundles 
 3 - minijar removes the manifest.mf from the resulting jar file
4* - I think that minijar can not cope with embeed jars instead due to the different classloading
behavior of the OSGi environment, so minijar can would only works with bundle containing "inlined"
classes

IMHO I think that the corrected workflow should be: minijar collects the dependencies and
strip them out (during the prepare-package phase). After that, maven-bundle-plugin build a
classpath pointing to the stripped artifact instead of the regular one. Finally, BND generates
the bundle. 
If you agree with my previous statement we should add an configuration entry to the maven-bundle-plugin
that specifies how and where to gather the dependecies jar file from.

At the moment I'm investigating how a integration with proguard-maven-plugin could be achieve.

> Add support for optimization and obfuscation of bundle contents
> ---------------------------------------------------------------
>
>                 Key: FELIX-336
>                 URL: https://issues.apache.org/jira/browse/FELIX-336
>             Project: Felix
>          Issue Type: New Feature
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-1.2.0, maven-bundle-plugin-1.2.1, maven-bundle-plugin-1.4.0
>            Reporter: Stuart McCulloch
>            Priority: Minor
>
> Suggestion from felix mailing list: it would be useful if the bundle-plugin could optimize
the contents of the bundle (ie. discard unnecessary internal contents) and possibly perform
some obfuscation. Ideally we wouldn't want to discard classes from exported packages as that
would lead to split-packages...
> Currently, it's possible to use the minijar plugin to optimize the bundle, but this could
discard exported classes as it has no OSGi knowledge.
> This issue will be used to collect together designs and opinions on baking such support
into the bundle-plugin compared to keeping it separate.

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


Mime
View raw message