I first tried this
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xdoclet-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<configuration>
<tasks>
<webdoclet destdir="target/generated-sources/xdoclet" mergedir="src/main/xdoclet" verbose="true">
<fileset dir="src/main/java"/>
<strutsconfigxml validatexml="true" version="1.1" destinationFile="struts-config.xml" />
</webdoclet>
</tasks>
</configuration>
<phase>generate-sources</phase>
<goals>
<goal>xdoclet</goal>
</goals>
</execution>
</executions>
</plugin>
which procedded to generate an empty struts-config.xml (well, it merged in my merge files but I had no actions or forms). It turns out that since my Forms and Actions inherit from a sub-class defined elsewhere, that class must be available in the classpath of the plugin. Unfortunately, there does not seem to be a way to modify a plugin's classpath.
I tried adding dependencies to the plugin, but none of that worked.
I tried the xdoclet2 maven2 plugin; it produced garbage struts-config.xml files; it seems to screw up the merge files.
I finally settled on using the antrun plugin to use the ant tasks. This allowed me to modify the webdoclet's classpath:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<tasks>
<taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="maven.compile.classpath" />
<webdoclet destdir="${project.build.directory}/generated-sources/xdoclet" mergedir="src/main/xdoclet" verbose="true">
<fileset dir="src/main/java" />
<strutsconfigxml validatexml="true" version="1.1" destinationFile="struts-config.xml" />
</webdoclet>
</tasks>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
What do you know, it worked!
2 comments:
Thanks for the workaround, you forgot to mention the needed dependencies:
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-web-module</artifactId>
<version>1.2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xdoclet</groupId>
<artifactId>xjavadoc</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
Thanks Tim. It worked for me. I also had similar issues. Now it is fixed after using antrun plugin.
-Ananth
Post a Comment