On 3 Nov 2011, at 04:37, Adrien Ragot wrote:

> Hi,
> 
> I'm trying to upgrade from maven-bundle-plugin 2.2.0 to 2.3.4 (they
> both use Bnd-1.15.0), and I'm checking there is no regression in the
> generated MANIFEST.MF.
> As far as I can see, Import-Package is not calculated as I expected. I
> suspect Bundle-ClassPath is not read anymore. Was there any change in
> this revision?

The main change affecting the manifest goal between 2.2.0 and 2.3.4 was to use 
the "supportedProjectTypes" parameter to decide whether to use the BND builder 
approach (which uses the given instructions to assemble the content and in 
doing so generates the manifest) versus using the BND analyzer approach (which 
looks for an existing archive attached to the project and extrapolates the 
manifest from its contents). The difference in the final manifest is all to do 
with how these two approaches analyze the project classpath. For example, since 
there's no instruction to include the dependency jar mentioned in the 
Bundle-ClassPath in the bundle and that jar is not located relative to the 
project, the builder approach decides to ignore that entry (note it does 
actually produce a warning, but this is only reported in the latest snapshot of 
the bundleplugin). On the other hand, the analyzer approach can find it in the 
attached archive, because it only looks at the end result and doesn't attempt 
to apply the instructions to the original project.

The JIRA issue for this change was 
https://issues.apache.org/jira/browse/FELIX-2817 ... unfortunately the 
background leading up to this change is missing, but perhaps Hiram Chirino can 
fill in the details since he made the commit. IIRC it was something to do with 
making the manifest goal behave similar to the bundle goal, so you'd get the 
same results as if you'd used the bundle goal on the same project.

Unfortunately you can't use "supportedProjectTypes" to get the old behaviour 
back, since removing the project type from that list will just end up skipping 
the manifest goal (this is because "supportedProjectTypes" was originally meant 
as a way to let you decide which projects to run bundleplugin goals on).

We could easily change this back to the old behaviour, and instead provide a 
new explicit parameter to use the BND builder approach rather than attempt to 
guess what the developer wants. In some respect there are two use cases - one 
to create the manifest for a project before the artifact has been created, and 
one to create a manifest for an existing artifact.

Could you open an issue at 
https://issues.apache.org/jira/browse/FELIX/component/12311143 ?  The next 
release is not far away, so the sooner the better :)

> I've written a small example:
> 
>            <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>                <version>2.3.4</version>
>                <extensions>true</extensions>
>                <executions>
>                    <execution>
>                        <goals>
>                            <goal>manifest</goal>
>                        </goals>
>                    </execution>
>                </executions>
>                <configuration>
>                    <instructions>
> 
> <Export-Package>org.adrien.exprt;version="1.4.0-SNAPSHOT"</Export-Package>
> 
> <Bundle-ClassPath>.,lib/minimal-dependancy-1.4.0-SNAPSHOT.jar</Bundle-ClassPath>
>                    </instructions>
>                </configuration>
>            </plugin>
> 
> - "minimal-dependancy.jar" contains a reference to "org.antlr.tool" so
> I expect to see it in Import-Package.
> - my artifact uses "org.adrien.imprted" from "minimal-dependancy.jar",
> so I don't expect to see it in Import-Package.
> 
> Unfortunately:
> Old Import-Package: org.adrien.exprt,org.antlr.analysis,org.antlr.tool
> New Import-Package:
> org.adrien.exprt;version="[1.4,2)",org.adrien.imprted,org.antlr.analysis
> 
> See the diff: 
> https://bitbucket.org/aragot/discrepancywithbndlib/changeset/670d96221620
> And the full example:
> https://bitbucket.org/aragot/discrepancywithbndlib/src/670d96221620
> 
> -Does this mean Bundle-ClassPath is not read anymore and was something
> changed in maven-bundle-plugin 2.3.4?
> -Also, I wouldn't expect to see "org.adrien.exprt", because I
> explicitly export it. Does anyone know why this class is imported?
> 
> Thank you very much,
> Adrien
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to