osgi.enroute icon indicating copy to clipboard operation
osgi.enroute copied to clipboard

Suggestion: generate -runbundles in archetype

Open njbartlett opened this issue 6 years ago • 7 comments

The bndrun files generated by the archetype have -runrequires populated but not -runbundles. This forces the user to do a resolve before the project can build cleanly.

Why not prepopulate -runbundles in the initial archetype output? We already know exactly what it will be at this stage. Then the user can immediately build and run.

njbartlett avatar Jun 06 '18 09:06 njbartlett

Why not prepopulate -runbundles in the initial archetype output?

What would we populate it with? In the majority of cases the bundle in -runrequires will have dependencies and we don't know what they are.

timothyjward avatar Jun 06 '18 09:06 timothyjward

The bundle will not have any dependencies immediately after generation from the archetype. Even if the user starts adding basic "hello world" code to the bundle, they will not need to worry about dependencies until later on.

The output of resolving immediately after generation of the project is:

-runbundles: \
        org.apache.felix.scr;version='[2.1.0,2.1.1)',\
        ${project.groupId}.${project.artifactId};version='[1.0.0,1.0.1)'

njbartlett avatar Jun 06 '18 09:06 njbartlett

The bundle will not have any dependencies immediately after generation from the archetype. Even if the user starts adding basic "hello world" code to the bundle, they will not need to worry about dependencies until later on.

I can see that this is reasonable for the project archetype, but the application archetype could be run very late in the process and pointed at an existing bundle with many dependencies. Isn't it better to say nothing and force a resolve rather than appear to have resolved but get errors when attempting to run?

timothyjward avatar Jun 06 '18 09:06 timothyjward

I can see that this is reasonable for the project archetype, but the application archetype could be run very late in the process and pointed at an existing bundle with many dependencies.

Then maybe we just do this for the project archetype. If the app archetype is used late in the process then the user will have learned about resolving at that point. But for the project archetype I think it's a win to remove steps in the way of "Hello world".

Isn't it better to say nothing and force a resolve rather than appear to have resolved but get errors when attempting to run?

I don't think there's a difference. The build will fail at the resolve stage, whether -runbundles is empty or non-empty-with-incorrect-content.

njbartlett avatar Jun 06 '18 10:06 njbartlett

I don't think there's a difference. The build will fail at the resolve stage, whether -runbundles is empty or non-empty-with-incorrect-content.

There is a difference if you're in Eclipse. An empty -runbundles prevents you from launching using the Run button, but a non-empty -runbundles will launch and fail to resolve. I'm not sure which I think is the more obvious to fix...

timothyjward avatar Jun 06 '18 10:06 timothyjward

Okay good point. Then I propose to leave -runbundles empty for the app archetype but populate it for the project template.

njbartlett avatar Jun 06 '18 10:06 njbartlett

Sounds good - will you make a PR?

timothyjward avatar Jun 06 '18 10:06 timothyjward