1

mvn 테스트에서 실제로 잘못된 점을 확인하는 데 도움을주십시오.mvn 테스트 예외 | 부두 - 서버 | UnsupportedClassVersion

[email protected]:myproj$ mvn test 
[INFO] Scanning for projects... 
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.myproj:jar:1.0.0-SNAPSHOT 
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 83, column 15 
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. 
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects. 
[WARNING] 
[INFO] Inspecting build with total of 1 modules... 
[INFO] Installing Nexus Staging features: 
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building myproj 1.0.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ myproj --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 32 resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ myproj --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ myproj --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 10 resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ myproj --- 
[INFO] Changes detected - recompiling the module! 
[INFO] Compiling 15 source files to /home/nik/myproj/target/test-classes 
[WARNING] Note: Some input files use unchecked or unsafe operations. 
[WARNING] Note: Recompile with -Xlint:unchecked for details. 
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ myproj --- 
[INFO] Surefire report directory: /home/nik/myproj/target/surefire-reports 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 
org.apache.maven.surefire.util.SurefireReflectionException:      java.lang.reflect.InvocationTargetException; nested exception is   java.lang.reflect.InvocationTargetException: null 
java.lang.reflect.InvocationTargetException 
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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) 
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) 
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) 
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) 
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) 
Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : 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 java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
at java.lang.Class.getDeclaredMethods0(Native Method) 
at java.lang.Class.privateGetDeclaredMethods(Class.java:2436) 
at java.lang.Class.getMethod0(Class.java:2679) 
at java.lang.Class.getMethod(Class.java:1605) 
at org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:57) 
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:65) 
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:60) 
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:55) 
at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:52) 
at org.apache.maven.surefire.util.DefaultDirectoryScanner.locateTestClasses(DefaultDirectoryScanner.java:80) 
at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:174) 
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:83) 
... 9 more 

Results : 

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 14.101s 
[INFO] Finished at: Fri Feb 28 19:43:56 PST 2014 
[INFO] Final Memory: 21M/59M 
[INFO] ------------------------------------------------------------------------ 

추가 정보 :

[email protected]:myproj$ java -version 
java version "1.6.0_45" 
Java(TM) SE Runtime Environment (build 1.6.0_45-b06) 
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode) 

[email protected]:myproj$ javac -version 
javac 1.6.0_45 

pom.xml은 거대하다. 따라서 surefire-pluginjetty-server에 관련된 스 니펫 만 붙여 넣기.

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
     <configuration> 
    </configuration> 
    </plugin> 


<dependency> 
    <groupId>org.eclipse.jetty</groupId> 
    <artifactId>jetty-server</artifactId> 
    <version>9.1.0.M0</version> 
    <scope>test</scope> 
</dependency> 

답변

2

오류의 흥미로운 부분은 이것이다 :

Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : Unsupported major.minor version 51.0 

이것은 당신이 당신 java -version 자바 7에 대한 컴파일 (이 경우 org.eclipse.jetty.server.Handler에) 클래스 파일이 들어있는 항아리를 사용하는 것을 의미 출력이 표시되면 Java 1.6.0_45를 사용 중입니다. java [c]를 1.7로 업그레이드해야합니다.

+0

의미가 있습니다. 이 사실을 확인하고, 실제로 해당되는 경우 대답을 수락합니다. – Nik

+0

이것은 사실이었습니다. Java 6와 호환되지 않는 jetty-server version 9.something을 사용하고있었습니다. – Nik