On 17/05/2008, Gerolf Seitz <[EMAIL PROTECTED]> wrote: > > yes, trunk for 1.4.x > appreciate your help with this...
Hi Gerolf, the following patch should work - I bumped the maven-jar-plugin to v2.2 because that version has the "useDefaultManifestFile" switch that will use the manifest created by the bundleplugin, but won't fail when the manifest file is missing (as happens in the parent pom) I also moved the "test-jar" execution to pluginManagement, like the rest of the plugins and switched off "useDefaultManifestFile" just for this execution, so it doesn't accidentally pick up the OSGi manifest when jar'ing up the tests Note: by default, the manifest goal will export+import all packages found in each project, and import any packages that are used but not included in the jar. because this can lead to large sets of import constraints, I decided to limit the explicit set of imports to "org.apache.wicket..." for now and add a "Dynamic-ImportPackage: *" setting which will defer any other import resolution to runtime (ie. on-demand). (this saves users from having to hunt around for OSGi bundles of other dependencies, that they may never need because they don't actually call that code) I also turned off the calculation of "uses" constraints because this also adds a lot of verbiage to the manifest that you probably don't need right now. I was able to successfully build the trunk with this patch and also made sure the jars could be loaded into various OSGi frameworks, although I haven't got time to actually try using them in a full-blown OSGi web-application HTH ########################################################################### Index: wicket/pom.xml =================================================================== --- wicket/pom.xml (revision 657291) +++ wicket/pom.xml (working copy) @@ -62,16 +62,6 @@ <licenseLocation>${basedir}/../../../common/lib/clover.license</licenseLocation> </configuration> </plugin> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> </build> </project> Index: pom.xml =================================================================== --- pom.xml (revision 657291) +++ pom.xml (working copy) @@ -545,15 +545,15 @@ <inherited>true</inherited> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> + <inherited>true</inherited> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <inherited>true</inherited> + </plugin> </plugins> <pluginManagement> @@ -616,8 +616,9 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>2.1</version> + <version>2.2</version> <configuration> + <useDefaultManifestFile>true</useDefaultManifestFile> <archive> <index>true</index> <manifest> @@ -628,6 +629,16 @@ </manifestEntries> </archive> </configuration> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + <configuration> + <useDefaultManifestFile>false</useDefaultManifestFile> + </configuration> + </execution> + </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -703,6 +714,27 @@ </executions> <inherited>true</inherited> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>1.4.1</version> + <executions> + <execution> + <id>bundle-manifest</id> + <phase>process-classes</phase> + <goals> + <goal>manifest</goal> + </goals> + <configuration> + <instructions> + <Import-Package>org.apache.wicket*</Import-Package> + <Dynamic-ImportPackage>*</Dynamic-ImportPackage> + <_nouses>true</_nouses> + </instructions> + </configuration> + </execution> + </executions> + </plugin> </plugins> </pluginManagement> </build> ###########################################################################
Index: wicket/pom.xml =================================================================== --- wicket/pom.xml (revision 657291) +++ wicket/pom.xml (working copy) @@ -62,16 +62,6 @@ <licenseLocation>${basedir}/../../../common/lib/clover.license</licenseLocation> </configuration> </plugin> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> </build> </project> Index: pom.xml =================================================================== --- pom.xml (revision 657291) +++ pom.xml (working copy) @@ -545,15 +545,15 @@ <inherited>true</inherited> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> + <inherited>true</inherited> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <inherited>true</inherited> + </plugin> </plugins> <pluginManagement> @@ -616,8 +616,9 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>2.1</version> + <version>2.2</version> <configuration> + <useDefaultManifestFile>true</useDefaultManifestFile> <archive> <index>true</index> <manifest> @@ -628,6 +629,16 @@ </manifestEntries> </archive> </configuration> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + <configuration> + <useDefaultManifestFile>false</useDefaultManifestFile> + </configuration> + </execution> + </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -703,6 +714,27 @@ </executions> <inherited>true</inherited> </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>1.4.1</version> + <executions> + <execution> + <id>bundle-manifest</id> + <phase>process-classes</phase> + <goals> + <goal>manifest</goal> + </goals> + <configuration> + <instructions> + <Import-Package>org.apache.wicket*</Import-Package> + <Dynamic-ImportPackage>*</Dynamic-ImportPackage> + <_nouses>true</_nouses> + </instructions> + </configuration> + </execution> + </executions> + </plugin> </plugins> </pluginManagement> </build>