我们的项目是在 jdk 1.7.0_17 上使用 maven 开发的,因为我在代码中导入了 org.omg.CORBA.IntHolder,然后运行“mvn clean install”,它给了我错误“导入 org.omg .CORBA 无法解析”
不知道为什么,我可以在%JAVA_HOME%\jre\lib\rt.jar中找到无法解析的类文件
我的pom文件配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>eclipse</compilerId>
<source>1.7</source>
<target>1.7</target>
<compilerVersion>1.7</compilerVersion>
<proceedOnError />
<optimize>true</optimize>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)
以前有人解决过这个问题吗?对此的任何解决方案或想法将不胜感激。
我遇到了几乎同样的问题,
在 Eclipse 中,maven 无法编译它并给出相同的消息:
The import org.omg.CORBA cannot be resolved
Run Code Online (Sandbox Code Playgroud)
原来是eclipse的jre的问题。
所以必须为 eclipse 工作区提供合适的 JDK版本
window -> preferences -> Java -> installed JREs
Run Code Online (Sandbox Code Playgroud)
我在其他具有不同编译错误的项目中遇到了该错误
,即有时是lombok dependentecy 编译错误,也可能存在其他错误。
事实上,这都是关于所使用的编译器而不是 mvn 的。