4

我们的项目是在 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>

以前有人遇到过这个问题吗?对此的任何解决方案或想法将不胜感激。

4

1 回答 1

0

我遇到了几乎相同的问题,
在 Eclipse 中,maven 无法编译它并给出相同的消息:

The import org.omg.CORBA cannot be resolved

原来是eclipse的jre才是问题所在。
因此必须为 Eclipse 工作区提供适当的 JDK版本

window -> preferences -> Java -> installed JREs

该错误在其他具有不同编译错误的项目中遇到了我,
即有时lombok依赖编译错误,其他错误也可能存在。
实际上,这完全是关于使用的编译器而不是 mvn。

于 2021-08-11T22:03:25.650 回答