开发者

Errors when compiling a java program with maven on windows

I'm attempting to compile javabot on windows using maven 2. I've compiled java programs in the past ( so I know the default JDK is working correctly), and this is my first time using maven. The error I'm getting is:

[INFO] Compilation failure

\evanchooly-javabot-dbea131\apt-tools\src\main\java\javabot\maven\Indexer.java:[23,37] package com.sun.tools.javac.processing does not exist error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider javabot.maven.Indexer not found

I (think) I've correctly set all the environment variables correctly, as directed to on the maven download page, as well as having upgraded to Java 1.6.0_22, and still the same errors.

I've contacted other people, who've told me th开发者_如何学Goat maven is able to compile the program correctly on OSX and Linux without any problems. Could someone give me clear instructions of what would need to be done to compile javabot on windows using maven? Thanks. (I'm running windows XP, 32 bit)


I've contacted other people, who've told me that maven is able to compile the program correctly on OSX and Linux without any problems. Could someone give me clear instructions of what would need to be done to compile javabot on windows using maven? Thanks. (I'm running windows XP, 32 bit)

Well, the project is in such a state that the above doesn't have any value, it's just impossible to build the current head version out of the box (missing module, missing dependencies, etc).

Anyway, try to add the following to the pom.xml of the apt-tools module:

<profile>
  <id>tools</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.6</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
    </dependency>
  </dependencies>
</profile>

Obviously, this is not tested.


com.sun.tools is an internal sun package. You are NOT supposed to code to them, as they can change at any time. For reference see : http://java.sun.com/products/jdk/faq/faq-sun-packages.html

The fact that your code broke, means that sun(oracle) did change the class that the tools were built against.

You have 2 ways to fix this.

1) Change the code to not rely on com.sun

2) Randomly change JDK versions until you find one that will compile it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜