-
-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bnd-maven-plugin] Running bnd-process
without mvn clean
causes different behavior
#6221
Comments
I spoted a comment in the code and wonder if that might be related: bnd/maven-plugins/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/AbstractBndMavenPlugin.java Line 532 in 3c005d4
and some bnd/maven-plugins/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/AbstractBndMavenPlugin.java Line 783 in 3c005d4
bnd/maven-plugins/bnd-maven-plugin/src/main/java/aQute/bnd/maven/plugin/AbstractBndMavenPlugin.java Line 609 in 3c005d4
Without anymore background knowledge I am wondering:
Is it possible that some other part is creating the Manifest in one case so that it does not go through bnd? |
Is that a question to me, or the other maintainers of this project? Though with the
With Maven debug logging the only difference for the second run seems to be this additional line:
It looks like this comes from here:
So it seems bnd is in some way reading the manifest it generated previously. But I would still expect that the results are then (ideally) the same. Besides the functionality-wise differences mentioned above this otherwise can also break reproducible builds. It appears a hacky workaround is then to specify a custom bnd-maven-plugin <manifestPath>${project.build.outputDirectory}/META-INF/bnd-MANIFEST.MF</manifestPath> (and then accordingly specifying maven-jar-plugin's |
It was more a thought out loud for anyone reading this😃 but i also did some debugging and found differences in Analyzer.java i will post details later when I'm back. |
First of all thanks for the reproducer zip file . I did some debugging. Here are some thoughts:
In this branch
This branch was touched in e12204d#diff-a526f72b59db4b5fb903e0254a07d2c143fb11a3ce160df375348a0399f7cf0bR2031-R2033
In this branch
It looks like it. @pkriens thoughts? |
I could get consistent results (clean, and no clean) when changing
to
always results in this
Update: also works with:
and also
but the latter that could be too broad. I think it is generally better to be specific. I don't have a good explanation for the behavior. Just found out about it e.g. in #1284 |
Here is the same project as a bnd-workspace. Maybe it helps debugging to track down things, in case something needs to be done. |
One thing I noticed during my experiments: I tried placing a packageinfo file in the packages as an alternative to versioning the Exports in Manifest. is this expected behavior? @pkriens In my bnd-workspace case (see comment above) those |
What seems wrong is that it picks up the manifest in the target/META-INF folder. This is output and should not be picked up. Since there are no versions set, the macro has nothing to base its work on so getting the macro is ok, although I am surprised it does not generate a warning. This is why you set the versions explicitly it is ok. But the fact that bnd sees is the target folder's Manifest is concerning. |
Might the code around here be a reason? @pkriens |
Yes, that seems to be the culprint ... I guess we need to delete the manifest if it is in the target/classes directory. |
Thanks. Do you have an idea to my other observation that the packageinfo files are not considered?
I would have expected them in the target Folder. Not sure if this is within the responsibility of the bnd-maven plugin. |
@Marcono1234 I have added a fix in #6222 which should be available in next bnd 7.1 snapshot (once reviewed and merged). This shoud fix at least the problem you describe initially with the inconsistent results with repeated |
Fixed via #6222 |
Version
Description
It looks like the behavior of bnd-maven-plugin's bnd-process differs when the Maven build is executed a second time, without
mvn clean
, respectively whentarget/classes/META-INF/MANIFEST.MF
exists from a previous run.Reproduction steps
mvn process-classes
target/classes/META-INF/MANIFEST.MF
namedclean-MANIFEST.MF
(but don't delete
MANIFEST.MF
)mvn process-classes
againNow compare
clean-MANIFEST.MF
withMANIFEST.MF
, you should see the following:(
clean-MANIFEST.MF
being old,MANIFEST.MF
being new)clean-MANIFEST.MF
MANIFEST.MF
Export-Package
uses
thenversion
version
thenuses
Import-Package
range
macro was not expanded (separate bug?)range
macro was expanded, as desiredImport-Package
example.b
has no version range (see also #6220)example.b
has a version rangeThe text was updated successfully, but these errors were encountered: