Hi all,
I'm developing an OSGi project based on the Felix implementation.
The developing environment I’m using is Eclipse equipped with Bndtools plugin. In the project, there are several packages. Each of them represents a bundle (for each package, there is a bundle descriptor, i.e. a .bnd file, and the "Enable sub-bundles" option is checked).
When I have to run the project, I simply open the bnd.bnd file and press the “Run OSGi” button. Instead, if I need to package the whole project in a single jar file in order to execute it on the “production server", I press (again in the bnd.bnd file panel) the “Export” button.
These procedures work well, but now I want to automate them in the context of a Continuos Integration flow, which is made up of a Bitbucket repo, a Jenkins server and Docker. So, how can I run my OSGi project or, even better, package it in a jar file through Command Line? In this way, the Jenkins server could package the project starting from its source code and deploy the resulting jar file on the proper docker container (currently I manually export the jar and run it on the docker container). I installed bnd from the command line and I tried the "build", “run” and “package” commands.
The "build" command (bnd build) actually generates a jar file for each bundle in the "generated" folder, but it returns several warnings for each bundle. More specifically, for each "exported" bundle (package) it returns "The JAR is empty: The instructions for the JAR named BUNDLE_NAME did not cause any content to be included, this is likely wrong". For each private bundle it returns two additional warnings:
1. Unused Private-Package instructions, no such package(s) on the class path: [PACKAGE_NAME]
2. Bundle-Activator PACKAGE_NAME.ACTIVATOR_CLASS_NAME is being imported into the bundle rather than being contained inside it. This is usually a bundle packaging error
The “run" command (bnd run) returns "missing dependency" errors for all bundles I have developed. Finally, the “package” command (bnd package bnd.bnd) returns the error:
“Errors
000: For project PROJECT_NAME, file bnd.jar, failed to create executable exception java.lang.NullPointerException,
001: Project has multiple bnd files, please select one of the bnd files"
P.S. I also evaluated the use of Apache Ace for CI purposes, but I was no able to successfully use it.
Thanks in advance.
Best regards,
Vincenzo
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dear Raymond,thanks for your quick response.Sorry for the dumb question, but...how can I check if my workspace uses gradle?
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-users+unsubscribe@googlegroups.com.
On Wed, Sep 13, 2017 at 3:27 PM, Vincenzo Mighali <pha...@gmail.com> wrote:Dear Raymond,thanks for your quick response.Sorry for the dumb question, but...how can I check if my workspace uses gradle?Check inside the directory which contains the projects (the directory which also contains the cnf directory).
If you see the files gradlew and/or gradlew.bat execute the appropriate one.HTH,- Ray
Il giorno mercoledì 13 settembre 2017 22:18:31 UTC+2, Raymond Auge ha scritto:On Wed, Sep 13, 2017 at 3:27 PM, Vincenzo Mighali <pha...@gmail.com> wrote:Dear Raymond,thanks for your quick response.Sorry for the dumb question, but...how can I check if my workspace uses gradle?Check inside the directory which contains the projects (the directory which also contains the cnf directory).
If you see the files gradlew and/or gradlew.bat execute the appropriate one.HTH,- RayInside that directory I have only the cnf directory and the project directory. The only reference to gradle that I found is a "gradle" directory (containing the biz.aQute.bnd.gradle.jar file) inside the cnf directory.Could my project have no build automation systems? Is it possible to integrate gradle without a substantial project refactoring? If so, I would really appreciate some tips on how using gradle to automate the building process.
Going on the assumption that you have a bnd workspace which uses gradle to build.if you run `./gradlew tasks` you should see:
Export tasks
------------
export - Export all the bndrun files to runnable jars.
export.agent.subsystem - Export the agent.subsystem.bndrun file to an executable jar.
export.demo - Export the demo.bndrun file to an executable jar.
export.launch - Export the launch.bndrun file to an executable jar.
export.x - Export the x.bndrun file to an executable jar.
resolve - Resolve the runbundles required for each of the bndrun files.
resolve.agent.subsystem - Resolve the runbundles required for agent.subsystem.bndrun file.
resolve.demo - Resolve the runbundles required for demo.bndrun file.
resolve.launch - Resolve the runbundles required for launch.bndrun file.
resolve.x - Resolve the runbundles required for x.bndrun file.
runbundles - Create a distribution of the runbundles in each of the bndrun files.
runbundles.agent.subsystem - Create a distribution of the runbundles in the agent.subsystem.bndrun file.
runbundles.demo - Create a distribution of the runbundles in the demo.bndrun file.
runbundles.launch - Create a distribution of the runbundles in the launch.bndrun file.
runbundles.x - Create a distribution of the runbundles in the x.bndrun file.- Ray
Going on the assumption that you have a bnd workspace which uses gradle to build.if you run `./gradlew tasks` you should see:
Export tasks
------------
export - Export all the bndrun files to runnable jars.
export.agent.subsystem - Export the agent.subsystem.bndrun file to an executable jar.
export.demo - Export the demo.bndrun file to an executable jar.
export.launch - Export the launch.bndrun file to an executable jar.
export.x - Export the x.bndrun file to an executable jar.
resolve - Resolve the runbundles required for each of the bndrun files.
resolve.agent.subsystem - Resolve the runbundles required for agent.subsystem.bndrun file.
resolve.demo - Resolve the runbundles required for demo.bndrun file.
resolve.launch - Resolve the runbundles required for launch.bndrun file.
resolve.x - Resolve the runbundles required for x.bndrun file.
runbundles - Create a distribution of the runbundles in each of the bndrun files.
runbundles.agent.subsystem - Create a distribution of the runbundles in the agent.subsystem.bndrun file.
runbundles.demo - Create a distribution of the runbundles in the demo.bndrun file.
runbundles.launch - Create a distribution of the runbundles in the launch.bndrun file.
runbundles.x - Create a distribution of the runbundles in the x.bndrun file.- Ray
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Can you reduce it to an example you can share? Without any details like your bnd files in the projects, I cannot really diagnose your problem.
Also have you looked at https://github.com/osgi/enroute.workspace/ which is the example Bnd workspace for enRoute?
Can you reduce it to an example you can share? Without any details like your bnd files in the projects, I cannot really diagnose your problem.