我有一个简单的Maven项目:
src
??? main
??? java
??? module-info.java
pom.xml
Run Code Online (Sandbox Code Playgroud)
pom.xml中:
<groupId>org.example</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>example</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
当我通过构建项目时mvn -X install -DskipTests=true,它失败了:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (default-testCompile) on project example: Execution default-testCompile of goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) …Run Code Online (Sandbox Code Playgroud) 我使用Eclipse Luna win32.x86_64运行Java 8.
这里来自Help Menu > About > Installation Detail > Configuration Tab:
java.runtime.version=1.8.0_05-b13
java.version=1.8.0_05
Run Code Online (Sandbox Code Playgroud)
我创建了新的插件项目,请求JavaSE-1.8作为执行环境:

在myplugin/META-INF/MANIFEST.MF我的文件当然:
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Run Code Online (Sandbox Code Playgroud)
我在产品文件中使用此插件.当我尝试验证它时,我收到以下错误:

当然,如果我开始使用该产品,我会得到:
!ENTRY org.eclipse.osgi 2 0 2014-07-10 08:14:22.042
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-07-10 08:14:22.043
!MESSAGE Bundle update@********/myplugin/ was not resolved.
!SUBENTRY 2 myplugin 2 0 2014-07-10 08:14:22.044
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))".
Run Code Online (Sandbox Code Playgroud)
我试过验证了很多:
首选项> Java>已安装的JRE …
如果我在我的Eclipse插件中将JavaSE-10指定为最小执行环境:
在Eclipse应用程序启动插件时出现以下错误:
org.osgi.framework.BundleException: Could not resolve module: org.treez.core [597]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
Unresolved requirement: Require-Bundle: org.treez.javafxd3; visibility:="reexport"
-> Bundle-SymbolicName: org.treez.javafxd3; bundle-version="1.0.0.qualifier"; singleton:="true"
org.treez.javafxd3 [586]
Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=10))"
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1613)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Run Code Online (Sandbox Code Playgroud)
我查了一下
我使用Oxygen.3a Release(4.7.3a)Build id:20180405-1200
=>这是eclipse equinox中的一个错误吗?
=>我还可以检查以解决此问题?
如果我从最小执行环境设置中删除JavaSE-10,我就可以启动Eclipse应用程序,并且该插件似乎工作正常.
当我导出插件时,我收到以下警告:
# 25.04.18, 12:25:40 MESZ
# Eclipse Compiler for Java(TM) v20180330-0919, 3.13.102, Copyright IBM Corp 2000, 2015. All rights reserved.
option -bootclasspath not …Run Code Online (Sandbox Code Playgroud) 我已将Java更新为版本10.0.1,现在我无法再运行Eclipse了.
它显示了这条消息:
必须提供Java运行时环境(JRE)或Java开发工具包(jdk)才能运行eclipse.搜索以下位置后未找到Java虚拟机:
C:\Program Files\Java\ire1.8.0_144\bin
我尝试从高级设置插入新路径但不起作用.
尝试将Maven从Java 9迁移到Java 10会在pom.xml中产生错误,这 maven-compiler-plugin不起作用:
Java 9配置(效果非常好):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.9</source>
<target>1.9</target>
<release>9</release>
<executable>javac9</executable>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
基于此 stackoverflow问题的Java 10配置(失败):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>10</source>
<target>10</target>
<release>10</release>
<executable>javac10</executable>
<encoding>UTF-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1.1</version> <!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)
错误mvn clean package :
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ XR3Player ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 164 source files to D:\GitHub\XR3Player\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] …Run Code Online (Sandbox Code Playgroud)