views:

155

answers:

2

i came across this http://mvnrepository.com/artifact/javadoc/javadoc but it stated sun not allow redistribution. i have a maven project that required to use com.sun.javadoc.* . which repository can i use to grab the dependency?

p/s: i'm using eclipse

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.5</version>
</dependency>
+1  A: 

Just use the regular maven-javadoc-plugin which runs the javadoc from your JDK, which you already have a valid copy of. Be sure that JAVA_HOME points to a JDK and not a JRE, and that the 'java' command in your path is from the JDK, not the JRE.

bmargulies
i added dependency like above in pom.xml but com.sun.* still not found and give error . my full pom.xml look like http://tinyurl.com/ya83kgj
cometta
Check that your JAVA_HOME and CLASSPATH are correct and that the javadoc jar is present in the correct location.
Chris Nava
yup my java_home path is correct. com.sun.javadoc in inside this file D:\work\Java\jdk1.6.0_13\src.zip
cometta
the src.zip is not relevant. It's never in classpath.
bmargulies
+1  A: 

I'm not sure this is what you're asking but classes from com.sun.javadoc are in tools.jar (which can't be distributed). If for whatever reason you need these classes on the class path, add the following dependency:

<dependencies>
  <dependency>
    <groupId>sun.jdk</groupId>
    <artifactId>tools</artifactId>
    <version>1.5.0</version>
    <scope>system</scope>
    <systemPath>${java.home}/../lib/tools.jar</systemPath>
  </dependency>
</dependencies>

See How do I include tools.jar in my dependencies?‎

Pascal Thivent