-
Notifications
You must be signed in to change notification settings - Fork 601
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
Move bnd-maven-plugin to a profile. #1665
base: master
Are you sure you want to change the base?
Conversation
But that also means that you are not able to test the OSGi stuff with a local build, because the MANIFEST.MF files are not generated with the necessary OSGi meta-data. You need to do a release build, which you can not do locally IIUC. So how would you verify that the changes work in an OSGi environment with a local build after that change? IMHO that change is unfortunate. |
I created this PR somewhat as an experiment, not sure if the builds will pass. I think the fact that the builds pass shows that there are no automated tests of the OSGi functionality. What is your expectation for testing - manual or automated tests? I'm not aware of anyone doing manual testing either - am I missing anything? |
I suppose there are no automatic OSGi tests, as before the OSGi bundle was created in a separate step that created the p2 repository. Now the artifacts are itself OSGi bundles. But I have not added OSGi specific tests, would need to see how that would look like. So I was referring to manual tests, which I did a lot while I was implementing the changes. If you ever have an issue related to OSGi, nobody will be able to work in that area, because you will only get the OSGi meta-data on a release build. So it can only be fixed after a release. It actually generates the meta-data. Why do you want it to be done only for a release and not already at development time? This way the release artifacts would be different in terms of the content from development artefacts. |
If folks do want to do OSGi testing manually, I could arrange the maven profiles slightly differently to make that happen. Rather than reuse the However, I suspect there are no manual tests of OSGi functionality of any sort. You know I was running into trouble getting the bnd annotations to be recognized by my IDE. After staring at the problem for a while I realized that it was running the maven build which broke the IDE, and running a clean build from the IDE which fixed it. That means whenever I'm running tests or debugging in the IDE, I'm doing so after clearing out everything related to OSGi. There is probably another way forward here, which is to configure the IDE with annotation processors or whatever it needs in order to understand the OSGi metadata, but I don't know how. |
What setup do you have? Which IDE? What steps do you perform to raise the issue you have? Maybe I can reproduce it somehow and find a better solution. |
To reproduce:
Open IntelliJ. Navigate to any test. As an example, I was just working on UnmodifiableMutableOrderedMapTest. Click the gutter icon that looks like a play button to run the test. The IDE will error out with many lines of the form:
To get around this error, navigate to the Build menu, then Rebuild Project. This is the step that's like a clean and gets rid of all OSGi metadata. It takes a few minutes because it has to recompile everything. Afterward, the tests will run. If we switch back to maven and run
|
And why do you call |
No reason, I think either one will reproduce the issue. |
Have you tried the verify approach?
Craig P. Motlin ***@***.***> schrieb am Do., 8. Aug. 2024,
16:36:
… And why do you call mvn clean install and not just mvn clean verify?
No reason, I think either one will reproduce the issue.
—
Reply to this email directly, view it on GitHub
<#1665 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXGVI7WPLUPRKRFX2HZJKLZQN67ZAVCNFSM6AAAAABMGORN66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZVHE4TENBQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Just tried it now, same thing happens. While scrolling through the error messages to make sure they are identical, I realized there's another pattern of error mixed in. Same as before:
The one I didn't notice/mention before:
|
Hm, it looks like some issue with the generated jpms stuff. Maybe intellij uses the module.info to determine the test build module path. Need to investigate in that area. There are posts related to similar issues in the internet. Maybe the spi packages need to be specified somehow although not necessary at runtime? |
I can find several entries related to issues with intellij https://stackoverflow.com/questions/20137020/why-does-intellij-give-me-package-doesnt-exist-error To narrow down the issue, could you try to change the scope of the bnd annotations from provided to compile? Just to see if this changes anything. |
I tried changing the scope of the dependency to compile in both places, reran a clean maven build, and clicked run on some tests in IntelliJ. I got the error messages about "java: package aQute.bnd.annotation.spi is not visible", just the one error kind this time. |
I tried different IDEs to see if it is a general issue:
After the import I get several errors about missing classes. The generated sources in the target folder are not added as source folders!
Execution succeeds!
Execution succeeds!
After the import I get several errors about missing classes. The generated sources in the target folder are not added as source folders!
In the pom.xml file of the
Execution succeeds!
Execution succeeds!
No errors at this point. Probably because of the .idea folder or any other configuration.
Execution succeeds!
Execution fails with the IMHO it is a bug in IntelliJ.
My best guess is that when the projects are initially opened, IntelliJ does not recognize the JPMS nature. After the build there is some hook or other mechanism that spots the module-info.class in the resulting JAR and makes the projects "module" projects, which then bring up the error. Which I don't really understand, because the project itself is not setup as a Java module project. The module nature is added at build time and only in the resulting JAR. Maybe the I am not an IntelliJ user, and therefore I have absolutely no idea what is going on here and why. Sorry to say that, but at this point I am not able to help out anymore. The code is correct, the project setup could be corrected to work with all IDEs (see above, the pom.xml changes should be sufficient for both, Eclipse and VS Code). Why IntelliJ behaves this way, no idea. |
Moved bnd-maven-plugin configuration to the release-artifacts profile so that it will affect released jars but will otherwise not affect local development.
cc @fipro78