java.lang.TypeNotPresentException:输入org.apache.maven.plugin.surefire.SurefirePlugin不存在 - MAVEN

时间:2015-07-27 05:17:55

标签: java maven maven-plugin

我是Maven的新手并且一直在尝试为一个项目创建构建。当我开火时,我的误差低于:

mvn clean install

检查项目。

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ XYZ ---                                     
[WARNING] Error injecting: org.apache.maven.plugin.surefire.SurefirePlugin                                      
java.lang.TypeNotPresentException: Type org.apache.maven.plugin.surefire.SurefirePlugin not present             
    at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:115)                               
    at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)                                           
    at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)                      
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)        
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:54)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)                               
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:113)   
    at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)                                        
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:122)   
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)              
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)                          
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:46)      
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1009)                                                 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059)                                            
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005)                                                    
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)                                                                         
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)                                                    
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)                                                  
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)                                       
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)                                       
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:464)         
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:119)                        
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)                                          
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)                                          
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)                                          
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)                 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)                  
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)    
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)                                  
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)                                                           
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)                                                             
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)                                                                 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)                                                                  
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)                                                                    
    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)                                                
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/plugin/surefire/SurefireReportParameters                                
    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:401)                                  
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)                          
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)                            
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)                                          
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)                                          
    at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:107)                                                   
    ... 41 more                                                                                                                 
Caused by: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.SurefireReportParameters                              
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)                          
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)                            
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)                                          
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)                                          
    ... 56 more                                                                                                                 
[INFO] ------------------------------------------------------------------------                                                     
[INFO] BUILD FAILURE                                                                                                                
[INFO] ------------------------------------------------------------------------                                                     

任何人都可以帮助我理解这个错误。我发现下面的链接是解决方案,但没有运气。

TypeNotPresentException on javax.annotations.Nonnull

1 个答案:

答案 0 :(得分:3)

将此frag添加到pom.xml

的片段中
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
        </plugin>