0

i have the following dependency in my app as I need some classes from rt.jar.

    <dependency>
        <groupId>com.sun</groupId>
        <artifactId>rt</artifactId>
        <version>1.5.0_06</version>
        <scope>system</scope>
        <systemPath>${env.JAVA_HOME}/jre/lib/rt.jar</systemPath>
    </dependency>

I actually did mvn clean compile -X to print all debug info. It looks like it can identify the location on -classpath but always complains the the package doesn't exist during build failure.

Is there something I need to configure specifically to add this thing as part of my build?

ha9u63a7
  • 6,233
  • 16
  • 73
  • 108
  • What version of Java are you using? – Slaw Oct 01 '18 at 16:24
  • @Slaw jdk1.8u162. I know that they are not quite "Available" from java9 onwards. I am simply adding them as part of my JDK that's why it's "system" scope. – ha9u63a7 Oct 01 '18 at 16:25
  • Is this Oracle JDK – Isuru Oct 01 '18 at 16:25
  • @Isuru yes Oracle JDK – ha9u63a7 Oct 01 '18 at 16:26
  • 1
    There is a reason why that are not available anymore...So you are adding com.sun artifacts to JDK 1.8 build? sounds really wrong..and system scope anyway...can you elaborate why the rt.jar is needed? I would suggest to migrate the code... – khmarbaise Oct 01 '18 at 16:29
  • @khmarbaise we have some old and experimental features that use rt.jar and I cannot disclose certain details...but the question isn't about migration, it's about dependency resolution, and why it cannot find the jars. And it's available as part of JDK 8 which I am using. – ha9u63a7 Oct 01 '18 at 16:33
  • you don't need to add this dependency. it should pick those classes from java class path. I just checked using class file from rt jar. It compiles without this dependency – lakshman Oct 01 '18 at 16:40

0 Answers0