Junit上不支持的major.minor 51.0版本,但Web应用程序不支持 [英] Unsupported major.minor version 51.0 on Junit, but not web app

查看:80
本文介绍了Junit上不支持的major.minor 51.0版本,但Web应用程序不支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我们的应用服务器上运行Junits,但由于不支持的major.minor 51.0版本而失败.但是,Web应用程序随后可以构建,部署和运行正常.我不知道这是怎么发生的.我的Maven编译器的配置如下所示:

I'm running Junits on our app server that fail with Unsupported major.minor version 51.0. But, the web application then builds, deploys, and runs fine. I don't understand how this can happen. My maven compiler's config looks like this:

<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>

还有我的Junit依赖项:

And my Junit dependency:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <scope>test</scope>
  <version>4.10</version>
</dependency> 

有人能想到失败的原因吗?

Can anyone think of a reason this is failing?

推荐答案

maven-surefire-plugin 负责运行JUnit测试.尝试添加此配置.

The maven-surefire-plugin is responsible for running JUnit tests. Try adding this config.

<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>

这篇关于Junit上不支持的major.minor 51.0版本,但Web应用程序不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆