I am trying to build a maven (latest version 3.1.1) project and for some reason when I run any maven command, such as maven clean, or maven compile, I get the following error:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.slf4j.LoggerFactory.reset()V from class org.slf4j.MavenSlf4jFriend
at org.slf4j.MavenSlf4jFriend.reset(MavenSlf4jFriend.java:33)
at org.apache.maven.cli.logging.impl.Slf4jSimpleConfiguration.activate(Slf4jSimpleConfiguration.java:60)
at org.apache.maven.cli.MavenCli.logging(MavenCli.java:348)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:205)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
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)
at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Had the same problem with Maven on OS X 10.9 installed using Brew. It turns out Maven brought its own libs including slf4j into /usr/local/Cellar/maven/3.2.2/libexec/lib. However I already had another version of slf4j in my classpath in /Library/Java/Extensions
Solution: remove slf4j from the OS X default classpath so that Maven can use its version without conflicts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With