Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] How to make Bundle.getEntry work properly when debugging a maven-bundle-plugin based bundle?

OK Igor, I found the origin of the problem...

The problem is a collateral effect caused by a hack that I introduced, some months ago, in order to eliminate the error marks (out of sync) accompanying our maven based bundles when they appeared in the 'Bundles' tab of an Eclipse OSGi Framework Run Configurations of PDE. Besides the fact that those bundles was working as expected that error mark was bothering me.

What I did was to create a profile activated only inside eclipse and I configured the maven-bundle-plugin to generate the manifest into the ${basedir}/META-INF directory instead the default one.
That removed the error mark from PDE but caused an issue when the bundle contains annotated DS components whose xml files are being generated by maven-scr-plugin because it generates the files into target/classes. So, I introduced an ant task to copy those files into a place that pde/equinox don't complains.

I've created a demonstration project here [1]. it has 3 different branches to show the different situations:

- without-ant -> maven-bundle-plugin and maven-scr-plugin generates its files in the default location, but the project has an error mark in Run Configurations.

- issue-when-mbp-generates-into-custom-manifest-location -> I change the place where the manifest is generated. the issue occurs because its not possible to locate the generated ds component xml files.

- with-ant -> I added an ant task to sync the generated component xmls and that fix the above issue. but as stated yesterday, it introduced a new error when using Bundle.getEntry()

Everything was working ok until now that I needed to debug a bundle using Bundle.getEntry(). :)

Well, for now I removed my hacks (the out of sync error mark returned of course)...

Do you think that are anything that could be done in m2e side in order to remove that error mark properly ?

best regards,

Cristiano


2014-12-10 15:11 GMT-03:00 Cristiano Gavião <cvgaviao@xxxxxxxxx>:
I'm using Equinox Luna to debugging... but this bundle runs at Equinox and Felix.

Ok, will provide one soon...

thanks

2014-12-10 14:49 GMT-03:00 Igor Fedorenko <igor@xxxxxxxxxxxxxx>:

What osgi framework do you use? I believe this works with equinox. Can you provide a small standalone example and steps to reproduce the problem?

On December 10, 2014 12:46:59 PM EST, "Cristiano Gavião" <cvgaviao@xxxxxxxxx> wrote:
>Hello,
>
>I'm facing a problem with a bundle created by maven-bundle-plugin that
>contains the myresource.xml resource file inside the
>src/main/resources/configuration directory.
>
>When running an eclipse OSGi debug, trying to get this resource using
>bundle.getEntry("/configuration/myresource.xml")  returns me a null
>value.
>
>Investigating, I searched for this resource using
>bundle.findEntries("/",
>"myresource.xml", true) and it returned me:
>
>[src/main/resources/configuration/myresource.xml,
>target/classes/configuration/myresource.xml]
>
>is this behaviour being caused by m2e or maven-bundle-plugin or PDE?
>
>anything I can do so bundle.getEntry("/configuration/myresource.xml")
>gives
>me the right value ?
>
>many thanks,
>
>Cristiano
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>m2e-users mailing list
>m2e-users@xxxxxxxxxxx
>To change your delivery options, retrieve your password, or unsubscribe
>from this list, visit
>https://dev.eclipse.org/mailman/listinfo/m2e-users

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



--
"Tudo vale a pena se a alma não é pequena..."



--
"Tudo vale a pena se a alma não é pequena..."

Back to the top