Skip to content
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

Export of bndrun fails but existing and calculated runbundles are identical #4082

Closed
njbartlett opened this issue May 20, 2020 · 6 comments · Fixed by #4392
Closed

Export of bndrun fails but existing and calculated runbundles are identical #4082

njbartlett opened this issue May 20, 2020 · 6 comments · Fixed by #4392

Comments

@njbartlett
Copy link
Member

Bnd 5.0.1 cannot build the enRoute Quickstart project.

I created a sample project as follows:

$ mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate \
    -DarchetypeGroupId=org.osgi.enroute.archetype \
    -DarchetypeArtifactId=project \
    -DarchetypeVersion=7.0.0 \
    -DgroupId=org.example \
    -DartifactId=example \
    -Dversion=1.0.0-SNAPSHOT \
    -Dpackage=org.example
$ cd example

I edited pom.xml to change <bnd.version>4.1.0</bnd.version> to 5.0.1 and then ran mvn clean verify and it failed on the export goal:

[INFO] --- bnd-export-maven-plugin:5.0.1:export (default) @ app ---
[ERROR] Error   : Fail on changes set to true (--xchange,-x) and there are changes
[ERROR] Error   :    Existing runbundles   [org.apache.felix.scr;version='[2.1.10,2.1.11)', org.example.impl;version='[1.0.0,1.0.1)']
[ERROR] Error   :    Calculated runbundles [org.apache.felix.scr;version='[2.1.10,2.1.11)', org.example.impl;version='[1.0.0,1.0.1)']

Note that the existing and calculated runbundles list are identical.

@njbartlett
Copy link
Member Author

NB the same bug exists in 5.1.0-SNAPSHOT and 5.0.0.

@njbartlett
Copy link
Member Author

Sorry the bug is not quite reproducible as described, I missed the resolve step (though the error message from the export is very misleading).

I still think there is a problem but it manifests in a more complex project, I will try again to produce a reproducible example.

@jmini
Copy link
Contributor

jmini commented Nov 4, 2020

Even without changing the version from 4.1.0 to 5.2.0, I get an error when running the mvn clean install on the project generated by the archetype-generator:

[INFO] --- bnd-export-maven-plugin:4.1.0:export (default) @ app ---
[ERROR] Error   : The runbundles have changed. Failing the build!
Was: null
Is: \
	org.apache.felix.scr;version='[2.1.10,2.1.11)',\
	org.example.impl;version='[1.0.0,1.0.1)'

Tested with (mvn -version):

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /___/maven/3.6.3_1/libexec
Java version: 1.8.0_202, vendor: Azul Systems, Inc., runtime: /Users/___/.sdkman/candidates/java/8.0.202-zulu/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.2", arch: "x86_64", family: "mac"

@njbartlett : can you explain what you mean with "I missed the resolve step"

@jmini
Copy link
Contributor

jmini commented Nov 4, 2020

I found my solution in osgi/osgi.enroute#99, as explained in the linked documentation the OSGi Resolving step is needed. With maven:

mvn -pl app -am  bnd-indexer:index \
    bnd-indexer:index@test-index \
    bnd-resolver:resolve package

This adds following lines to the app.bndrun:

diff --git a/app/app.bndrun b/app/app.bndrun
index 1b66a66..d66d3ed 100644
--- a/app/app.bndrun
+++ b/app/app.bndrun
@@ -6,4 +6,7 @@ index: target/index.xml;name="app"
 -runfw: org.eclipse.osgi
 -runee: JavaSE-1.8
 
--resolve.effective: active
\ No newline at end of file
+-resolve.effective: active
+-runbundles: \
+       org.apache.felix.scr;version='[2.1.10,2.1.11)',\
+       org.example.impl;version='[1.0.0,1.0.1)'

@jmini
Copy link
Contributor

jmini commented Nov 4, 2020

The error message from the export is very misleading

I agree with @njbartlett here.

[INFO] --- bnd-export-maven-plugin:5.2.0:export (default) @ app ---
[ERROR] Error   : Fail on changes set to true (--xchange,-x) and there are changes
[ERROR] Error   :    Existing runbundles   [org.apache.felix.scr;version='[2.1.10,2.1.11)', org.example.impl;version='[1.0.0,1.0.1)']
[ERROR] Error   :    Calculated runbundles [org.apache.felix.scr;version='[2.1.10,2.1.11)', org.example.impl;version='[1.0.0,1.0.1)']

The Existing runbundles line is not what is defined in the app.bndrun file. No matter if it is empty (like was is generated by the archetype-generator) or if you introduce a manual change (like an other version) in the app.bndrun file.

jmini added a commit to jmini/bnd that referenced this issue Nov 4, 2020
Fixes: bndtools#4082

Signed-off-by: Jeremie Bresson <jeremie.bresson@unblu.com>
@jmini
Copy link
Contributor

jmini commented Mar 19, 2021

The issue is fixed with version 5.3.0. Output:

[INFO] --- bnd-export-maven-plugin:5.3.0:export (default) @ app ---
[ERROR] Error   : Fail on changes set to true (--xchange,-x) and there are changes
[ERROR] Error   :    Existing runbundles   null
[ERROR] Error   :    Calculated runbundles [org.apache.felix.scr;version='[2.1.10,2.1.11)', org.enroutexample.impl;version='[1.0.0,1.0.1)']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants