我在Eclipse Helios中创建了一个Maven项目.它可以正常工作一天,然后出现此警告:
构建路径指定执行环境J2SE-1.4.工作区中没有安装与此环境严格兼容的JRE.
由于此消息,项目停止编译和调试.有没有人有这个问题的解决方案?
我有一个JUnit4测试套件,我想在JUnit Plug-in Test运行配置下执行它.

它在通过JUnit Test配置运行时成功通过,但对于插件conf,它以不同的方式失败.
例如,如果我使用JUnit4TestAdapter它失败了ClassCastException,如果我试图仅通过@RunWith注释运行它,它会错误地"找不到方法".对于这两种实现,我JUnit4在运行配置中使用Test Runner设置.
我用
对于第一种情况,似乎Eclipse在执行套件时继续使用JUnit3版本.这里是:
@RunWith(Suite.class)
@SuiteClasses({ DndTest.class })
public class JSTestSuite {
public static Test suite() {
return new JUnit4TestAdapter(JSTestSuite.class);
}
}
Run Code Online (Sandbox Code Playgroud)
例外是:
java.lang.ClassCastException: junit.framework.JUnit4TestAdapter cannot be cast to junit.framework.Test
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:403)
Run Code Online (Sandbox Code Playgroud)
在开始测试时,我在控制台中有一条奇怪的日志消息:
!ENTRY org.eclipse.update.configurator 2017-05-04 17:58:57.279
!MESSAGE Could not install bundle ../../platform/eclipse/plugins/org.eclipse.jdt.junit4.runtime_1.1.600.v20160505-0715.jar No match is available for the required execution environment: J2SE-1.5
Run Code Online (Sandbox Code Playgroud)
我看到这个lib就在这个地方,但我无法理解为什么它无法加载.对于 …
我从简单的 Web 应用程序迁移到 Maven Web 应用程序,并使用 Eclipse Neon 遇到了一个令人沮丧的问题:在 pom.xml 中添加使用 Java 8 或 7 的规范后,它不起作用。
为了验证它是否有效,我编写了一个简单的类,在其中使用了 try(表达式) 声明。
我应该怎么做才能在 Maven 中使用 Java 8(我已经安装并且它可以在正常的 Web 应用程序中工作)?
pom.xml的代码是这样的:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.webdata</groupId>
<artifactId>WebParser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WebParser</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.23</version>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)