On 09/04/2008, Rowe, James <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm having a problem getting maven-compiler-plugin and > maven-bundle-plugin to play nicely together. Here's the build section of > my pom: > > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-compiler-plugin</artifactId> > <configuration> > <source>1.5</source> > <target>1.5</target> > </configuration> > </plugin> > <plugin> > <groupId>org.apache.felix</groupId> > <artifactId>maven-bundle-plugin</artifactId> > <version>1.4.0</version> > <extensions>true</extensions> > <configuration> > <manifestLocation>META-INF</manifestLocation> > <instructions> > <Import-Package>*<Import-Package> > <Export-Package>com.bofa.ib*</Export-Package> > </instructions> > </configuration> > </plugin> > </plugins> > </build> > > When maven-compiler-plugin is explicitly added to the build, inheritance > dependencies are not resolved. For example, our class uses > org.springframework.jdbc.core.JdbcTemplate, which extends > org.springframework.jdbc.support.JdbcAccessor (note the superclass lives > in a different package). The method we invoke is defined on > JdbcAccessor, hence the inheritance dependency. When the compiler > plugin is included in the build, the bundle plugin fails to import the > inherited org.springframework.jdbc.support package dependency. When the > compiler plugin is taken out of the build, the bundle plugin correctly > imports it. Of course, leaving out the compiler plugin means that 1.5 > source does not compile!
Hi James, the bundleplugin uses the Bnd tool to analyze bytecode, not the source, so it may well be that when you build it with 1.5 there is some difference in bytecode that means the inheritance doesn't appear (ie. perhaps some optimization) for example, with shared static final fields, there isn't actually a dependency between the classfiles because the javac compiler inlines the constant value... One workaround is to explicitly add the inherited package dependency in > the Import-Package instruction, but it's a bit painful having to do > this. Has anyone else experienced this? no I've not seen this before -and it's either due to a difference in the bytecode, or in the classpath passed to the bundleplugin from Maven (though how the compiler plugin is affecting it I'm really not sure, as Maven should isolate it to some extent). either way we'll need a recreatable testcase attached to a JIRA issue to properly investigate - you might also want to use the -X debug setting with both non-1.5 and 1.5 builds and see if there's any obvious difference in the classpath used by each build. (redirect the debug ouput to a file, because it's very verbose) HTH Thanks, > James. > > Notice to recipient: > The information in this internet e-mail and any attachments is > confidential and may be privileged. It is intended solely for the addressee. > If you are not the intended addressee please notify the sender immediately > by telephone. If you are not the intended recipient, any disclosure, > copying, distribution or any action taken or omitted to be taken in reliance > on it, is prohibited and may be unlawful. > > When addressed to external clients any opinions or advice contained in > this internet e-mail are subject to the terms and conditions expressed in > any applicable governing terms of business or client engagement letter > issued by the pertinent Bank of America group entity. > > If this email originates from the U.K. please note that Bank of America, > N.A., London Branch and Banc of America Securities Limited are authorised > and regulated by the Financial Services Authority. For all U.K. corporate > disclosures, please refer to www.bankofamerica.com/ukcompanies > -- Cheers, Stuart

