7

Our project is developed with maven on jdk 1.7.0_17, as i imported org.omg.CORBA.IntHolder in my code and then run "mvn clean install" it gives me errors "The import org.omg .CORBA cannot be resolved"

I don't know why, i can find the class file which can not be resolved in %JAVA_HOME%\jre\lib\rt.jar

my pom file was configured as below:

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

Did anyone meed this issue before? Any solution or idea on this will be with gratitude.

jsm25
  • 71
  • 1
  • 3
  • what does it do when you just set `source` and `target` configuration elements? – Gus Jul 19 '13 at 15:35
  • Can you post the entire POM here? The plugin I'm familiar with is http://mojo.codehaus.org/idlj-maven-plugin/ - BTW, CORBA is all 7 layers of hell combined into 1 api. – sevensevens Jul 19 '13 at 18:22
  • @sevensevens : I don't know how to post my POM here, but the code in the question is almost the whole of it, just add groupId,artifactId,version and project tage with it.Thanks for your answer. – jsm25 Jul 20 '13 at 01:12
  • @Gus : It works well as i remove tag from the POM, but i must use plexus-compiler-eclipse for compiling instead of javac – – jsm25 Jul 20 '13 at 01:26
  • Here is link http://www.gabiaxel.com/2011/10/replacing-javac-with-eclipse-compiler.html They are describing how it should work, and it matches what you have written. So the error is either the different version, check an older one. Or some boundary conditions are wrong. – Christian Jul 23 '13 at 09:12
  • See http://stackoverflow.com/questions/17712838 . I think it could be related to having upper case letters in the package name. – onlynone Apr 21 '16 at 15:49

1 Answers1

2

I had almost same issue,
In Eclipse the maven can't compile it giving the same message:

The import org.omg.CORBA cannot be resolved

it turned out to be the jre of the eclipse is the problem.
so had to provide the eclipse workspace with an appropriate JDK version

window -> preferences -> Java -> installed JREs

the error met me in other projects with different compilation errors
i.e. sometimes lombok dependecy compilation errors, other errors might exist too.
And it was all about the compiler used not the mvn in fact.

M. Amer
  • 916
  • 10
  • 12
  • 2
    The problem occurs because the java.corba module (for example, org.omg.CORBA* packages) were deprecated in Java 9. In Java 11, that module is no longer be available. Maybe you can upgrade your answer with a solution for Java 9, 10 and 11? http://support.sas.com/kb/63/716.html – coz Jan 11 '22 at 12:25