`

M2Eclipse遭遇java.lang.UnsupportedClassVersionError

阅读更多

转载 http://mail-archives.apache.org/mod_mbox/maven-users/200810.mbox/%3C20262610.post@talk.nabble.com%3E

 

Maven 遭遇java.lang.UnsupportedClassVersionError:.... (Unsupported major.minor version 49.0)

 

 

Hi Thomas,

I had the same issue, when you configure the maven-compiler-plugin with java
1.4 in your POM then m2eclipse automatically sets the 1.4 in the project
build path, but then you have the exception you quote when you try to run
maven commands.

I found several workarounds:

1. Change the project configuration in Eclipse:
   - in the Java Build path, set JRE 1.5 or 1.6
   - in the Java Compiler configuration, set Compiler compliance level to
1.4
Then you will be able to run maven, and your compiled code will be
compatible with Java 1.4
The drawback is that you will not be able to let m2eclipse update the
configuration (using Maven menu > Update Project Configuration) else you
lose this.

2. Change the Maven configuration in Eclipse to use an external Maven
program instead of the Embedder:
Window > Preferences > Maven > Installations
Because it is the Maven Embedder that is used by default to run Maven
programs and it requires Java 1.5 to work.

3. Use a custom launch configuration for your maven command in Run
Configurations... menu, there you can choose the Maven runtime to use
instead of the Embedder, as explained here:
http://docs.codehaus.org/display/M2ECLIPSE/Launching+Maven

There is a bug open about this issue:
http://jira.codehaus.org/browse/MNGECLIPSE-798
You can vote for it!

Amélie


thomas2004 wrote:
>
> Hi all,
>
> I use Eclipse Ganymede and I start it with Java 6. I've installed the
> maven plugin.
>
> But I configure a project with JRE of Java 1.4.2. As I run any maven
> command such as "mvn clean" or "mvn install", I got exception as follow.
> But as I change the JRE to Java 1.5, it's OK. But I do want to create
> project in Java 1.4. Any idea?
>
> java.lang.UnsupportedClassVersionError:
> org/apache/maven/artifact/resolver/AbstractArtifactResolutionException
> (Unsupported major.minor version 49.0)
>     at java.lang.ClassLoader.defineClass0(Native Method)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
>     at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
>     at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>     at
> org.apache.maven.cli.MavenCli.buildEmbedderConfiguration(MavenCli.java:204)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:138)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
> Exception in thread "main"
>

--
View this message in context: http://www.nabble.com/java.lang.UnsupportedClassVersionError%3A....-%28Unsupported-major.minor-version-49.0%29-tp20228678p20262610.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics