Community
Participate
Working Groups
Use maven-pax-plugin to generate OSGi project as well as OSGi bundle. When importing an OSGi bundle using m2eclipse, following line is always generated in .classpath: <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> event I've configured maven-compiler-plugin as following: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> Guess the reason is that packaing is "bundle" not normal "jar". Please check attachment project. Reproduce steps: 1. Follow http://www.sonatype.com/books/mcookbook/reference/index.html 1.2 and 1.5 to create an OSGi project and a bundle. 2. Add configuration for maven-compiler-plugin in parent pom.xml 3. Load all maven modules using m2eclipse 4. Check .classpath file of project org.sonatype.mcookbook Following output could be observed in Eclipse console: Could not determine source level, using default 1.4 Could not determine target level, using default 1.4 If I change packaging to "jar" instead of "bundle", everything is fine, JDK-1.6 will be used.
Please attach complete standalone project we can use to reproduce the problem.
Created attachment 195557 [details] the standalone project to reproduce the problem
(In reply to comment #1) > Please attach complete standalone project we can use to reproduce the problem. Sorry, I forgot to attach it.
Attached project does not use maven-compiler-plugin, so changing maven-compiler-plugin has no effect on project configuration. Please see osgi-project/poms/pom.xml for information how to configure the project to use maven-compiler-plugin. As a side note, I am surprised you were able to import the project in recent m2e 0.13.0 without obvious error markers to explain the problem. In my case the project did not have java configuration after import and there were two error markers on pom.xml file saying that org.ops4j:maven-pax-plugin:1.5:compile and org.ops4j:maven-pax-plugin:1.5:testCompile goals are not "covered". Are you sure you use m2e 0.13.0?
(In reply to comment #4) > Attached project does not use maven-compiler-plugin, so changing > maven-compiler-plugin has no effect on project configuration. Please see > osgi-project/poms/pom.xml for information how to configure the project to use > maven-compiler-plugin. > > As a side note, I am surprised you were able to import the project in recent > m2e 0.13.0 without obvious error markers to explain the problem. In my case the > project did not have java configuration after import and there were two error > markers on pom.xml file saying that org.ops4j:maven-pax-plugin:1.5:compile and > org.ops4j:maven-pax-plugin:1.5:testCompile goals are not "covered". Are you > sure you use m2e 0.13.0? Yes, you're right about the error markers. I didn't meeting this problem when using 0.13.0, but it is strange that the first time I imported projects there was no this error, but second time, I met this error marker. I'm not quite clear what "does not use maven-compiler-plugin" means as this plugin will be used when running "mvn compile", and projects does not depend on it of course. And if I change "bundle" to "jar", it just works.
(In reply to comment #5) > (In reply to comment #4) > > Attached project does not use maven-compiler-plugin, so changing > > maven-compiler-plugin has no effect on project configuration. Please see > > osgi-project/poms/pom.xml for information how to configure the project to use > > maven-compiler-plugin. > > > > As a side note, I am surprised you were able to import the project in recent > > m2e 0.13.0 without obvious error markers to explain the problem. In my case the > > project did not have java configuration after import and there were two error > > markers on pom.xml file saying that org.ops4j:maven-pax-plugin:1.5:compile and > > org.ops4j:maven-pax-plugin:1.5:testCompile goals are not "covered". Are you > > sure you use m2e 0.13.0? > > Yes, you're right about the error markers. I didn't meeting this problem when > using 0.13.0, but it is strange that the first time I imported projects there > was no this error, but second time, I met this error marker. > > I'm not quite clear what "does not use maven-compiler-plugin" means as this > plugin will be used when running "mvn compile", and projects does not depend on > it of course. And if I change "bundle" to "jar", it just works. Sorry, a few typos. I mean I did meet error marker problem, but first time no error, second time, got the problem.
Sorry but this is really annoying. Do you think this is still an invalid bug? If so, how can I tell m2 to load bundle module correctly?
There are two separate issues here. First, the attached project does NOT use maven-compiler-plugin, so changing maven-compiler-plugin configuration has no effect neither inside m2e nor during command line build. Second, the compiler the project does use, i.e. maven-pax-plugin, is not supported by m2e core and there is no thirdparty m2e extension that provides such support. The easiest short-term solution is to modify osgi-project/poms/pom.xml file and move <extensions> from maven-pax-plugin to maven-bundle-plugin as explained in the comment in the pom.xml file. Longer term solution requires developing m2e support for maven-pax-plugin. m2e team does not have immediate plans to do this, but we will be happy to review and apply a quality patch. If anyone is interested, please raise your hand on m2e-dev list and we'll help with pointers to get started.
(In reply to comment #8) > There are two separate issues here. > > First, the attached project does NOT use maven-compiler-plugin, so changing > maven-compiler-plugin configuration has no effect neither inside m2e nor during > command line build. > > Second, the compiler the project does use, i.e. maven-pax-plugin, is not > supported by m2e core and there is no thirdparty m2e extension that provides > such support. > > The easiest short-term solution is to modify osgi-project/poms/pom.xml file and > move <extensions> from maven-pax-plugin to maven-bundle-plugin as explained in > the comment in the pom.xml file. > > Longer term solution requires developing m2e support for maven-pax-plugin. m2e > team does not have immediate plans to do this, but we will be happy to review > and apply a quality patch. If anyone is interested, please raise your hand on > m2e-dev list and we'll help with pointers to get started. Thank you very much explaining the whole details to me, and moving "extensions" to maven-bundle-plugin did solve the problem although I'm not sure what "extension" is. Sorry I'm a beginner of Maven. And finally marking this bug as invalid.
Moved to https://github.com/eclipse-m2e/m2e-core/issues/