2

I'm trying to write a simple Java doclet program where it uses com.sun.javadoc package.

And I also imported the tools.jar as a dependency for the project. And I can run the application without a problem and the desired results can be obtained.

But when I'm trying to compile the project using maven it gives some errors and will fail the build as well.

[ERROR] /home/xxx/xxx/Check.java:[20,33] cannot find symbol
symbol:   class RootDoc
location: class com.sic.checkers.Check
[ERROR] /home/xxx/xxx/Check.java:[26,39] cannot find symbol
symbol:   class PackageDoc
location: class com.sic.checkers.Check
[ERROR] /home/xxx/xxx/ListTags.java:[3,1] package com.sun.javadoc does not exist
[ERROR] /home/xxx/xxx/ListTags.java:[6,33] cannot find symbol
symbol:   class RootDoc
location: class com.sic.checkers.ListTags
[ERROR] /home/xxx/xxx/ListTags.java:[12,39] cannot find symbol
symbol:   class ClassDoc
location: class com.sic.checkers.ListTags

I check other similar questions but they seems to have no solutions for this as well.

What can be the problem here !

prime
  • 14,464
  • 14
  • 99
  • 131

2 Answers2

3

I somehow managed to solve this problem and compile and build the code using maven. Did it with the help of this thread. And @GuyKhmel also suggested to add missing dependencies to the pom.xml.

Added a dependency for the project.

    <dependency>
        <groupId>com.sun</groupId>
        <artifactId>tools</artifactId>
        <version>1.4.2</version>
        <scope>system</scope>
        <systemPath>${java.home}/../lib/tools.jar</systemPath>
    </dependency>
prime
  • 14,464
  • 14
  • 99
  • 131
1

It sounds like you don't have the dependencies configured under <dependency> tag in your pom.xml file.

Could you paste it in pastebin.com and paste here?

You could read some more here: Maven: Introduction to Dependency Mechanism

GuyKhmel
  • 505
  • 5
  • 15