Bug 1123042

Summary: Maven Eclipse integration cannot find slf4j Logger class even if it's installed.
Product: [Fedora] Fedora Reporter: Diego <diego.ml>
Component: eclipse-m2e-coreAssignee: Gerard Ryan <fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: fedora, mizdebsk
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: eclipse-m2e-core-1.4.0-12.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-30 07:04:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Diego 2014-07-24 17:16:09 UTC
Description of problem:

When using "Run as..." - "Maven build" in a Maven project under Eclipse I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/Logger
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
	at java.lang.Class.getMethod0(Class.java:2813)
	at java.lang.Class.getMethod(Class.java:1663)
	at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
	... 9 more


Version-Release number of selected component (if applicable):
$ rpm -q eclipse-m2e-core
eclipse-m2e-core-1.4.0-11.1.fc20.noarch
$ rpm -q slf4j
slf4j-1.7.5-3.fc20.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install eclipse, eclipse-m2e-core and slf4j
2. git clone https://github.com/zxing/zxing.git
3. from Eclipse "Import" - "Maven" - "Existing Maven Projects"
4. select folder "zxing/core"
5. after import try "Run as" - "Maven build"

Actual results:
The backtrace listed above appears in Console tab.


Expected results:
Maven build runs without complaining.

Comment 1 Roland Grunberg 2014-07-24 17:28:40 UTC
I was just able to reproduce this as well.

It seems like sl4fj.api is not accessible by the maven runtime. It's an OSGi bundle, and everything certainly resolves correctly but I don't think that Maven is able to load the class unless it is directly bundled into the maven runtime plugin.

I did the following workaround :
cd /usr/share/eclipse/dropins/eclipse-m2e-core/eclipse/plugins/org.eclipse.m2e.maven.runtime-1.4.0-SNAPSHOT/jars
sudo ln -s /usr/share/java/slf4j/slf4j-api.jar .

Then in /usr/share/eclipse/dropins/eclipse-m2e-core/eclipse/plugins/org.eclipse.m2e.maven.runtime-1.4.0-SNAPSHOT/META-INF/MANIFEST.MF add ',jars/slf4j-api.jar' to the end of the list of Bundle-ClassPath entries.

I started Eclipse back up with the '-clean' option and the build proceeded.

Comment 2 Gerard Ryan 2014-07-24 17:53:53 UTC
@Diego: thanks for taking the time to report.

@Roland: thanks for taking the time to diagnose & produce a workaround.

I'll push a fix & create an update asap.

Comment 3 Fedora Update System 2014-07-25 21:12:12 UTC
eclipse-m2e-core-1.4.0-12.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/eclipse-m2e-core-1.4.0-12.fc20

Comment 4 Gerard Ryan 2014-07-25 21:14:52 UTC
(In reply to Fedora Update System from comment #3)
> eclipse-m2e-core-1.4.0-12.fc20 has been submitted as an update for Fedora 20.
> https://admin.fedoraproject.org/updates/eclipse-m2e-core-1.4.0-12.fc20

This adds the fix that Roland provided here. It fixes the issue for me. If you would like to test it, please do and give karma in bodhi! :)

Comment 5 Fedora Update System 2014-07-26 16:00:58 UTC
Package eclipse-m2e-core-1.4.0-12.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing eclipse-m2e-core-1.4.0-12.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-8907/eclipse-m2e-core-1.4.0-12.fc20
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2014-07-30 07:04:03 UTC
eclipse-m2e-core-1.4.0-12.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.