Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overcome "package com.sun.xml.internal.xxx does not exist" when compiling with Gradle? [closed]

Tags:

gradle

I want to compile java code that uses some Java's deprecated "sun" packages and Gradle compile task fails with this error

error: package com.sun.xml.internal.ws.developer does not exist

I am using Hotspot JDK and I can see this package there (so it actually exists - in rt.jar file) I also tried to add rt.jar itself into Gradle dependencies:

compile files( 'C:/Program Files/Java/jdk1.7.0_05/jre/lib/rt.jar')

but with no effect

here is my gradle -v output:

------------------------------------------------------------
Gradle 1.2
------------------------------------------------------------

Gradle build time: Streda, 2012, september 12 10:46:02 UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0_05 (Oracle Corporation 23.1-b03)
OS: Windows 7 6.1 amd64

I also tried to add jaxws-rt.jar to classpath - no effect neither

I would really appreciate any help

thanks

like image 839
user1746915 Avatar asked Oct 25 '12 12:10

user1746915


1 Answers

It's Oracle's intent that these classes be inaccessible at compile-time.

See the response to this javac bug report.

For a likely solution, see Using internal sun classes with javac . The javac -XDignore.symbol.file switch should fix this - but I'm a gradle newb, and don't see how to feed this to gradle's JavaCompile. My best guess is

  apply plugin: 'java' 
  compileJava.options.useAnt = true 
  compileJava.options.compilerArgs << "-XDignore.symbol.file" 

Incidentally, ct.sym (referred to in the link) appears to be a jar-file that lists, as class stubs, all the accessible classes.

like image 61
Ed Staub Avatar answered Nov 08 '22 19:11

Ed Staub