I'm currently trying to migrate an ant based build to maven and need to
generate some source code. We've got a tool that generates the code from
a load of dtd/xml type files and that needs to be compiled first, before
it's run to generate the source.
I've got the following in my pom -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<!-- Create the code tool output folder... -->
<mkdir dir="${project.build.directory}/generated-sources/main/codetool"
/>
<!-- Compile the code generation tool... -->
<javac
destdir="${project.build.directory}/generated-sources/main/codetool">
<classpath refid="${maven.compile.classpath}" />
<src path="${project.build.sourceDirectory}" />
<include name="codetool/**" />
<exclude name="com/**" />
</javac>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I'm doing this in phases, so I'm surrently just trying to get the tool to
be compiled, before adding a bit more to the task to actually run the tool
and generate the source files I need.
When I run the generate-sources lifecycle phase I get the following output -
[INFO] Scanning for projects...
[INFO]
----------------------------------------------------------------------------
[INFO] Building Management Dictionary
[INFO] task-segment: [generate-sources]
[INFO]
----------------------------------------------------------------------------
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
[javac] Compiling 8 source files to
C:\Development\management\trunk\dictionary\target\generated-sources\main\codetool
[INFO]
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
----------------------------------------------------------------------------
[INFO] Error executing ant tasks
Embedded error: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
[INFO]
----------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
----------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Mar 09 10:25:10 GMT 2006
[INFO] Final Memory: 2M/5M
[INFO]
----------------------------------------------------------------------------
My path and JAVA_HOME are set correctly in my environment. Am I missing
some properties or something...? I would have expected this to just work.
Cheers,
--
Bob Arnott
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]