我使用Xtext 2.9.1在Eclipse中创建了一个带有普通maven目录结构的新项目向导。我可以在eclipse中运行“mvn clean install”,但是当我尝试从命令行运行它时(我使用的是Windows 7)。我收到以下错误。它说Maven本身存在一个错误。有什么建议?谢谢。
[WARNING] Error injecting: org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant
java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant
not present
at org.eclipse.sisu.reflect.URLClassSpace.loadClass(URLClassSpace.java:108)
at org.eclipse.sisu.reflect.NamedClass.load(NamedClass.java:44)
at org.eclipse.sisu.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:44)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java
:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactor
yToInitializableAdapter.java:55)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70
)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionLi
stenerStackCallback.java:100)
at org.eclipse.sisu.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleMana
ger.java:134)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionLi
stenerStackCallback.java:109)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStac
kCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.ja
va:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToIni
tializableAdapter.java:47)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFact
oryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1054)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactory
Adapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProvider
Adapter.java:41)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
at org.eclipse.sisu.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
at org.eclipse.sisu.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52)
at org.eclipse.sisu.locators.EntryListAdapter$ValueIterator.next(EntryListAdapter.java:111)
at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
at org.apache.maven.DefaultMaven.getLifecycleParticipants(DefaultMaven.java:540)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:268)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
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:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/tycho/core/maven/TychoMavenLifecycleP
articipant : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.ja
va:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.eclipse.sisu.reflect.URLClassSpace.loadClass(URLClassSpace.java:100)
... 37 more
[ERROR] Internal error: com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) Error in custom provider, java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.
maven.TychoMavenLifecycleParticipant not present
[ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.23.1, parent: sun.misc.Launch
er$AppClassLoader@12360be0]
[ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.23.1, parent: sun.misc.Launch
er$AppClassLoader@12360be0]
[ERROR] while locating org.apache.maven.AbstractMavenLifecycleParticipant annotated with @com.google
.inject.name.Named(value=TychoMavenLifecycleListener)
[ERROR]
[ERROR] 1 error: org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant : Unsupported major.min
or version 51.0
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: com.google.inject.ProvisionException: Guice
provision errors:
1) Error in custom provider, java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.maven.Ty
choMavenLifecycleParticipant not present
at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.23.1, parent: sun.misc.Launcher$App
ClassLoader@12360be0]
at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.23.1, parent: sun.misc.Launcher$App
ClassLoader@12360be0]
while locating org.apache.maven.AbstractMavenLifecycleParticipant annotated with @com.google.injec
t.name.Named(value=TychoMavenLifecycleListener)
1 error
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:165)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
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:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: com.google.inject.ProvisionException: Guice provision errors:
1) Error in custom provider, java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.maven.Ty
choMavenLifecycleParticipant not present
at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.23.1, parent: sun.misc.Launcher$App
ClassLoader@12360be0]
at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.23.1, parent: sun.misc.Launcher$App
ClassLoader@12360be0]
while locating org.apache.maven.AbstractMavenLifecycleParticipant annotated with @com.google.injec
t.name.Named(value=TychoMavenLifecycleListener)
1 error
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1006)
at org.eclipse.sisu.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
at org.eclipse.sisu.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52)
at org.eclipse.sisu.locators.EntryListAdapter$ValueIterator.next(EntryListAdapter.java:111)
at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
at org.apache.maven.DefaultMaven.getLifecycleParticipants(DefaultMaven.java:540)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:268)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
... 11 more
Caused by: java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.maven.TychoMavenLifecycleP
articipant not present
at org.eclipse.sisu.reflect.URLClassSpace.loadClass(URLClassSpace.java:108)
at org.eclipse.sisu.reflect.NamedClass.load(NamedClass.java:44)
at org.eclipse.sisu.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:44)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java
:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactor
yToInitializableAdapter.java:55)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70
)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionLi
stenerStackCallback.java:100)
at org.eclipse.sisu.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleMana
ger.java:134)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionLi
stenerStackCallback.java:109)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStac
kCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.ja
va:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToIni
tializableAdapter.java:47)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFact
oryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1054)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactory
Adapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProvider
Adapter.java:41)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
... 18 more
Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/tycho/core/maven/TychoMavenLifecycleP
articipant : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.ja
va:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.eclipse.sisu.reflect.URLClassSpace.loadClass(URLClassSpace.java:100)
... 37 more
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
答案 0 :(得分:1)
java.lang.UnsupportedClassVersionError
是因为编译期间JDK较高,运行时期间JDK较低。
要解决实际问题,您应该尝试使用较新版本的Java JRE运行Java代码,或者指定Java编译器的目标参数,以指示编译器创建与早期Java版本兼容的代码。
例如,要生成与Java 1.7兼容的类文件,请使用以下命令行:
javac -target 1.7 HelloWorld.java
对于较新版本的Java编译器,您可能会收到有关未设置引导类路径的警告。有关此错误的更多信息,请参阅 oracle blog post
如何解决问题的另一个很好的解释here。