简体   繁体   中英

Maven and wscompile

Hello I am trying to use wscompile ant task from Maven. I am able to call the ant task using the antrun Maven plugin. But wscompile started complaining:

[wscompile] error : com.sun.tools.javac.Main is not available in the classpath..

so I added the tools.jar as dependency as below

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

but no luck , so I Googled and got a solution as to add fork="true" to the wscompile task and it worked. Does any one know a better solution than this?

An alternative is to ensure you have a JAVA_HOME environment variable pointing to your JDK directory.

For example on Windows:

set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_26

or on Linux:

export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.26"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM