Search code examples
javamavengeotools

Build problems with Maven and GeoTools (com.sun.javadoc)


I'm trying to build GeoTools 8.0-RC2 (itself, not a tutorial project or the like) with Maven 3.0.4. When I run mvn install on the root pom it seems to work fine until a build error concerning com.sun.javadoc and com.sun.tools.doclets occurs.

The complete error trace is as follows:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project javadoc: Compilation failure: Compilation failure:
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[22,22] error: package com.sun.javadoc does not exist
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[23,28] error: package com.sun.tools.doclets does not exist
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[33,37] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[40,50] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[160,33] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[171,33] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[20,22] error: package com.sun.javadoc does not exist
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[21,28] error: package com.sun.tools.doclets does not exist
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[32,39] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[38,49] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[130,33] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[141,33] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Source.java:[161,28] error: cannot find symbol
[ERROR] \GeoTools\GIT\build\maven\javadoc\src\main\java\org\geotools\maven\taglet\Tutorial.java:[131,28] error: cannot find symbol

Unfortunately, I didn't find a solution with Google, but took a look at lib\tools.jar in my JDK 1.7.0 u5 and discovered the missing packages there. The pom that depends on tools.jar is build\maven\javadoc\pom.xml. There are two profiles, one for SUN JDKs and one for IBM JDKs:

<profile>
    <id>default-tools.jar</id>
    <activation>
        <property>
            <name>java.vendor</name>
            <value>Sun Microsystems Inc.</value>
        </property>
    </activation>
    <dependencies>
        <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.5</version>
            <scope>system</scope>
            <systemPath>${java.home}/../lib/tools.jar</systemPath>
  <!-- Note: a ${tools.jar} variable exists - we should try to use it. -->
        </dependency>
    </dependencies>
</profile>

I'm on Windows 7 x64 and my %JAVA_HOME% is set to C:\Program Files\Java\jdk1.7.0_05. I tried messing around with it but had no luck. The error remains. May Sun Microsystems Inc. be the problem because now it's from Oracle or <version>1.5</version> because I have version 1.7 installed?

Would be really nice if someone could help me out here!

Regards, Alex


Solution

  • This could be of help. Instead of just Oracle try Oracle Corporation. http://sunnytalkstech.blogspot.in/2011/08/maven-dependency-for-toolsjar-in-jdk7.html