[
https://issues.apache.org/jira/browse/FELIX-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stuart McCulloch resolved FELIX-395.
------------------------------------
Resolution: Invalid
1) Please look carefully at your BND instructions:
<Export-Package>*</Export-Package>
this line is asking BND to add all classes from the compile+runtime classpath
to the bundle, which is why you are seeing all those unpacked classes. If your
intention is that the complete contents of the bundle should be exported
(without affecting the calculation of the bundle contents) then you should use:
<_exportcontents>*</_exportcontents> <!-- same as -exportcontents:
option in the BND docs -->
as BND will then not drag in all the classes, but will include the embedded
resource(s) and export them accordingly. If you don't want everything exported
then you will need to explicitly list the public packages you want to export.
2) wrt. the import issue - it is standard BND practice to import any packages
that are exported, see:
http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
if you don't want a package imported then either don't export it (ie. if it's a
private implementation class) or add the ';-noimport:=true' modifier to any
package clauses in Export-Package or -exportcontents. However, you are strongly
recommended to import anything you export to avoid casting issues (as explained
in the above post)
Some background to embedding:
the embed instructions act as a pre-processor to BND (as BND doesn't know
anything about Maven or its dependency chain) - the bundle plugin updates the
Include-Resource and Bundle-ClassPath statements to get BND to embed or unpack
the jar(s) and make them available on the bundle's classpath.
BND uses the Export-Package, Import-Package and Include-Resource instructions
to "pull" together the contents of the bundle, which is why Export-Package:*
pulls in all those classes. Because it is useful to want to alter the exports
of a bundle without changing the classes that get pulled in, I asked Peter to
add the -exportcontents option.
see http://www.aqute.biz/Code/Bnd for full usage.
> Plugin packages classes when inline=false is specified
> ------------------------------------------------------
>
> Key: FELIX-395
> URL: https://issues.apache.org/jira/browse/FELIX-395
> Project: Felix
> Issue Type: Bug
> Components: Maven Bundle Plugin
> Reporter: Eugene Kuleshov
> Priority: Critical
>
> I've been playing with Felix's Maven Bundle Plugin from trunk and there is a
> critical issue
> <project
> xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>org.test</groupId>
> <artifactId>test</artifactId>
> <name>test OSGi bundle</name>
> <version>1.0.0-SNAPSHOT</version>
> <packaging>bundle</packaging>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> </dependency>
> </dependencies>
> <build>
> <defaultGoal>org.apache.felix:maven-bundle-plugin:bundle</defaultGoal>
>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>1.1.0-SNAPSHOT</version>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Export-Package>*</Export-Package>
>
> <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
> <Embed-Transitive>true</Embed-Transitive>
> <Embed-StripGroup>true</Embed-StripGroup>
> <Embed-Directory>jars</Embed-Directory>
> </instructions>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>
> When running "mvn" command in the above pom it will create
> test-1.0.0-SNAPSHOT.jar with the following content. As you can see, jar file
> have an original junit-3.8.1.jar, but it also have all classes from
> junit-3.8.1.jar repackaged:
> Archive: test-1.0.0-SNAPSHOT.jar
> testing: META-INF/MANIFEST.MF OK
> testing: META-INF/ OK
> testing: META-INF/maven/ OK
> testing: META-INF/maven/org.test/ OK
> testing: META-INF/maven/org.test/test/ OK
> testing: META-INF/maven/org.test/test/pom.properties OK
> testing: META-INF/maven/org.test/test/pom.xml OK
> testing: jars\junit-3.8.1.jar OK
> testing: junit/ OK
> testing: junit/awtui/ OK
> testing: junit/awtui/AboutDialog$1.class OK
> testing: junit/awtui/AboutDialog$2.class OK
> testing: junit/awtui/AboutDialog.class OK
> testing: junit/awtui/Logo.class OK
> testing: junit/awtui/ProgressBar.class OK
> testing: junit/awtui/TestRunner$1.class OK
> testing: junit/awtui/TestRunner$10.class OK
> testing: junit/awtui/TestRunner$2.class OK
> testing: junit/awtui/TestRunner$3.class OK
> testing: junit/awtui/TestRunner$4.class OK
> testing: junit/awtui/TestRunner$5.class OK
> testing: junit/awtui/TestRunner$6.class OK
> testing: junit/awtui/TestRunner$7.class OK
> testing: junit/awtui/TestRunner$8.class OK
> testing: junit/awtui/TestRunner$9.class OK
> testing: junit/awtui/TestRunner.class OK
> testing: junit/extensions/ OK
> testing: junit/extensions/ActiveTestSuite$1.class OK
> testing: junit/extensions/ActiveTestSuite.class OK
> testing: junit/extensions/ExceptionTestCase.class OK
> testing: junit/extensions/RepeatedTest.class OK
> testing: junit/extensions/TestDecorator.class OK
> testing: junit/extensions/TestSetup$1.class OK
> testing: junit/extensions/TestSetup.class OK
> testing: junit/framework/ OK
> testing: junit/framework/Assert.class OK
> testing: junit/framework/AssertionFailedError.class OK
> testing: junit/framework/ComparisonFailure.class OK
> testing: junit/framework/Protectable.class OK
> testing: junit/framework/Test.class OK
> testing: junit/framework/TestCase.class OK
> testing: junit/framework/TestFailure.class OK
> testing: junit/framework/TestListener.class OK
> testing: junit/framework/TestResult$1.class OK
> testing: junit/framework/TestResult.class OK
> testing: junit/framework/TestSuite$1.class OK
> testing: junit/framework/TestSuite.class OK
> testing: junit/runner/ OK
> testing: junit/runner/BaseTestRunner.class OK
> testing: junit/runner/ClassPathTestCollector.class OK
> testing: junit/runner/FailureDetailView.class OK
> testing: junit/runner/LoadingTestCollector.class OK
> testing: junit/runner/ReloadingTestSuiteLoader.class OK
> testing: junit/runner/SimpleTestCollector.class OK
> testing: junit/runner/Sorter$Swapper.class OK
> testing: junit/runner/Sorter.class OK
> testing: junit/runner/StandardTestSuiteLoader.class OK
> testing: junit/runner/TestCaseClassLoader.class OK
> testing: junit/runner/TestCollector.class OK
> testing: junit/runner/TestRunListener.class OK
> testing: junit/runner/TestSuiteLoader.class OK
> testing: junit/runner/Version.class OK
> testing: junit/runner/excluded.properties OK
> testing: junit/runner/logo.gif OK
> testing: junit/runner/smalllogo.gif OK
> testing: junit/swingui/ OK
> testing: junit/swingui/AboutDialog$1.class OK
> testing: junit/swingui/AboutDialog$2.class OK
> testing: junit/swingui/AboutDialog.class OK
> testing: junit/swingui/CounterPanel.class OK
> testing: junit/swingui/DefaultFailureDetailView$StackEntryRenderer.class
> OK
> testing: junit/swingui/DefaultFailureDetailView$StackTraceListModel.class
> OK
> testing: junit/swingui/DefaultFailureDetailView.class OK
> testing: junit/swingui/FailureRunView$1.class OK
> testing: junit/swingui/FailureRunView$FailureListCellRenderer.class OK
> testing: junit/swingui/FailureRunView.class OK
> testing: junit/swingui/ProgressBar.class OK
> testing: junit/swingui/StatusLine.class OK
> testing: junit/swingui/TestHierarchyRunView$1.class OK
> testing: junit/swingui/TestHierarchyRunView.class OK
> testing: junit/swingui/TestRunContext.class OK
> testing: junit/swingui/TestRunView.class OK
> testing: junit/swingui/TestRunner$1.class OK
> testing: junit/swingui/TestRunner$10.class OK
> testing: junit/swingui/TestRunner$11.class OK
> testing: junit/swingui/TestRunner$12.class OK
> testing: junit/swingui/TestRunner$13.class OK
> testing: junit/swingui/TestRunner$14.class OK
> testing: junit/swingui/TestRunner$15.class OK
> testing: junit/swingui/TestRunner$16.class OK
> testing: junit/swingui/TestRunner$17.class OK
> testing: junit/swingui/TestRunner$18.class OK
> testing: junit/swingui/TestRunner$19.class OK
> testing: junit/swingui/TestRunner$2.class OK
> testing: junit/swingui/TestRunner$3.class OK
> testing: junit/swingui/TestRunner$4.class OK
> testing: junit/swingui/TestRunner$5.class OK
> testing: junit/swingui/TestRunner$6.class OK
> testing: junit/swingui/TestRunner$7.class OK
> testing: junit/swingui/TestRunner$8.class OK
> testing: junit/swingui/TestRunner$9.class OK
> testing: junit/swingui/TestRunner.class OK
> testing: junit/swingui/TestSelector$1.class OK
> testing: junit/swingui/TestSelector$2.class OK
> testing: junit/swingui/TestSelector$3.class OK
> testing: junit/swingui/TestSelector$4.class OK
> testing: junit/swingui/TestSelector$DoubleClickListener.class OK
> testing: junit/swingui/TestSelector$KeySelectListener.class OK
> testing: junit/swingui/TestSelector$ParallelSwapper.class OK
> testing: junit/swingui/TestSelector$TestCellRenderer.class OK
> testing: junit/swingui/TestSelector.class OK
> testing: junit/swingui/TestSuitePanel$1.class OK
> testing: junit/swingui/TestSuitePanel$TestTreeCellRenderer.class OK
> testing: junit/swingui/TestSuitePanel.class OK
> testing: junit/swingui/TestTreeModel.class OK
> testing: junit/swingui/icons/ OK
> testing: junit/swingui/icons/error.gif OK
> testing: junit/swingui/icons/failure.gif OK
> testing: junit/swingui/icons/hierarchy.gif OK
> testing: junit/swingui/icons/ok.gif OK
> testing: junit/textui/ OK
> testing: junit/textui/ResultPrinter.class OK
> testing: junit/textui/TestRunner.class OK
> testing: stylesheet.css OK
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.