Junit上不支持major.minor版本51.0,但不支持Web应用程序

Tod*_*odd 3 java junit junit4 maven

我在我们的应用服务器上运行Junits,该服务器因不支持的major.minor版本51.0而失败.但是,Web应用程序然后构建,部署和运行正常.我不明白这是怎么发生的.我的maven编译器的配置如下所示:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId> 
  <version>2.3.2</version>
  <configuration>
    <verbose>true</verbose>
    <fork>true</fork>
    <source>1.7</source>
    <target>1.7</target>
    <executable>${JAVA_1_7_HOME}/bin/javac</executable>
    <encoding>ISO-8859-1</encoding>
    <verbose>true</verbose> 
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

而我的Junit依赖:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <scope>test</scope>
  <version>4.10</version>
</dependency> 
Run Code Online (Sandbox Code Playgroud)

任何人都可以想到这是失败的原因吗?

use*_*849 6

Maven的万无一失,插件是负责运行JUnit测试.尝试添加此配置.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId> 
  <version>2.16</version>
  <configuration>
    <jvm>${JAVA_1_7_HOME}/bin/javac</jvm>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)