OK, it's working for me, but my workaround is quite ugly. A copy of my previous message is attached.
I fork a new instance of Ant in a separate jvm and let a pure Ant build
file do the xdoclet stuff for me. Here's my maven.xml:
<project xmlns:j="jelly:core" xmlns:m="maven"
xmlns:maven="jelly:org.apache.maven.jelly.tags.project.MavenTagLibrary">
<preGoal name="java:compile">
<path id="gen.java.compile.src.set" location="src/gen-java"/>
<maven:addPath id="maven.compile.src.set"
refid="gen.java.compile.src.set"/>
<attainGoal name="ejbdoclet"/>
</preGoal>
<postGoal name="java:prepare-filesystem">
<attainGoal name="prepare-filesystem-for-xdoclet"/>
</postGoal>
<goal name="ejbdoclet">
<java classname="org.apache.tools.ant.Main" fork="true">
<classpath>
<fileset dir="${maven.repo.local}/ant/jars">
<include name="*.jar"/>
</fileset>
<fileset dir="${maven.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
<arg value="-buildfile"/>
<arg value="./run-xdoclet.xml"/>
</java>
</goal>
<goal name="prepare-filesystem-for-xdoclet">
<mkdir dir="src/gen-java"/>
</goal>
</project>
And run-xdoclet.xml looks like this:
<?xml version="1.0"?>
<project name="XDoclet" default="run-xdoclet">
<target name="run-xdoclet">
<property file="build.properties"/>
<taskdef name="ejbdoclet"
classname="xdoclet.modules.ejb.EjbDocletTask">
<classpath>
<fileset dir="${xdoclet.maven.repo.local}/sun/jars">
<include name="*.jar"/>
</fileset>
<fileset dir="${xdoclet.maven.repo.local}/jakarta/jars">
<include name="*.jar"/>
</fileset>
<fileset dir="${xdoclet.maven.repo.local}/xdoclet/jars">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<ejbdoclet
destdir="src/gen-java"
excludedtags="@version,@author"
ejbspec="2.0">
<fileset dir="${xdoclet.pom.build.SourceDirectory}">
<include name="**/**Bean.java" />
</fileset>
<session/>
<remoteinterface/>
<homeinterface />
<utilobject/>
<!--
<deploymentdescriptor destdir="${ejb.dd.dir}"
validatexml="true" useIds="${websphere}"/>
-->
</ejbdoclet>
</target>
</project>
You may ask why don't you use <ant/> from the maven.xml file? Well,
because it doesn't work:
java:compile:
ejbdoclet:
[ERROR] BUILD FAILED
[ERROR] File...... D:\Projects\Petsoar\maven.xml
[ERROR] Element... ant
[ERROR] Line...... 13
[ERROR] Column.... 81
[ERROR] java.lang.NullPointerException
Total time: 25 seconds
But I can run run-xdoclet.xml from command line easily. Folks, Maven
seems to have some classloader problems, or maybe some trouble with path
refs.
Ara.
> -----Original Message-----
> From: Jim Crossley [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 09, 2002 10:02 PM
> To: Turbine Maven Users List
> Subject: Re: Xdoclet & maven, take 2
>
> Ok, I think I may have an idea what's wrong. Xdoclet seems to want to
> serialize its "context" to the file system. Apparently, there are
some
> objects in that context that are not Serializable. In particular,
> MavenJellyContext. Making that class Serializable revealed that
> org.apache.commons.grant.GrantProject is also not Serializable. :-(
>
> Jim
>
> On Monday 09 September 2002 01:59 pm, you wrote:
> > I'm not dumb, but I'm not smart enough to solve this.
> >
> > I'm still trying to get maven to invoke xdoclet and generate some
source
> (I
> > haven't even gotten to the point of compiling the source yet).
> >
> > I have this very simple goal in my maven.xml:
> >
> > <project default="prepare">
> > <goal name="prepare" description="Generate some source files">
> > <taskdef name="ejbdoclet" classname="xdoclet.ejb.EjbDocletTask"
> > classpathref="maven.dependency.classpath"/>
> > <ejbdoclet sourcepath="${maven.src.dir}/java" destdir="src-gen">
> > <fileset dir="${maven.src.dir}/java">
> > <include name="**/*Bean.java" />
> > </fileset>
> > </ejbdoclet>
> > </goal>
> > </project>
> >
> > Here's the error I get using jdk 1.4, maven 1.0-beta-6 and xdoclet
> 1.1.2:
> >
> > prepare:
> > [ejbdoclet] [ERROR] log4j:WARN No appenders could be found for
> logger
> >
>
(xdoclet.ConfigParamIntrospector.fillConfigParamsHashtableUsingReflectio
nF
> o
> >r). [ejbdoclet] [ERROR] log4j:WARN Please initialize the log4j system
> > properly.
> >
> > [ERROR] BUILD FAILED
> > [ERROR] Running ejbdoclet task failed. An IO error occured while
writing
> > context data.
> > [ERROR] at xdoclet.DocletTask.execute(DocletTask.java:250)
> > [ERROR] at org.apache.tools.ant.Task.perform(Task.java:317)
> > [ERROR] at
> > org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:198)
> > [ERROR] at
> >
org.apache.commons.jelly.impl.DynaTagScript.run(DynaTagScript.java:141)
> > [ERROR] at
> > org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:134)
> > [ERROR] at
> > org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:190)
> > [ERROR] at
> >
>
org.apache.commons.jelly.tags.werkz.GoalTag$1.performAction(GoalTag.java
:1
> 1
> >9) [ERROR] at com.werken.werkz.Goal.attain(Goal.java:524)
> > [ERROR] at
org.apache.maven.app.Maven.runGoals(Maven.java:941)
> > [ERROR] at
> org.apache.maven.app.Maven.attainGoals(Maven.java:842)
> > [ERROR] at org.apache.maven.app.App.doMain(App.java:334)
> > [ERROR] at org.apache.maven.app.App.main(App.java:842)
> > [ERROR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method) [ERROR] at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:
> 3
> >9) [ERROR] at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Im
> p
> >l.java:25) [ERROR] at
> > java.lang.reflect.Method.invoke(Method.java:324) [ERROR] at
> > com.werken.forehead.Forehead.run(Forehead.java:543) [ERROR]
at
> > com.werken.forehead.Forehead.main(Forehead.java:573) [ERROR]
File......
> > /home/jim/personal/jcrossley/projects/tracker/maven.xml [ERROR]
> Element...
> > ejbdoclet
> > [ERROR] Line...... 14
> > [ERROR] Column.... 21
> > [ERROR] Running ejbdoclet task failed. An IO error occured while
writing
> > context data.
> > Total time: 9 seconds
> >
> > Anyone else seen this? I'm not sure what else to try.
>
> --
> To unsubscribe, e-mail: <mailto:turbine-maven-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:turbine-maven-user-
> [EMAIL PROTECTED]>
--- Begin Message --- Title: RE: projects with multiple source directories> > It did as the antlr plugin provides a much better way to deal with
> > generated sources: you generate your sources to any given directory and
> > they you modify the the path using the <addPath/> so that you can
> > compile static sources along with generated sources.
> Ah, so someone just needs to do something similar for xdoclet...?OK, I tried to use xdoclet (latest cvs code) from within maven but this is the result:
[ejbdoclet] [ERROR] java.lang.NullPointerException
[ejbdoclet] [ERROR] at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:326)
[ejbdoclet] [ERROR] at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:401)
[ejbdoclet] [ERROR] at xdoclet.util.LogUtil.getLog(LogUtil.java:26)If you take a look at where the NPE is thrown you'll see that contextClassLoader is null. That's very strange! I think maven is setting a null contextClassLoader.
This is my maven.xml file:
<project xmlns:j="jelly:core" xmlns:m="maven">
<preGoal name="java:compile">
<attainGoal name="ejbdoclet"/>
</preGoal><goal name="ejbdoclet">
<taskdef name="ejbdoclet" classname="xdoclet.modules.ejb.EjbDocletTask">
<classpath>
<path refid="maven.dependency.classpath"/> </classpath>
</taskdef><ejbdoclet
destdir="src/gen-java"
excludedtags="@version,@author"
ejbspec="2.0"><fileset dir="${pom.build.SourceDirectory}">
<include name="**/service/**Bean.java" />
</fileset><session/>
...Note the taskdef uses maven.dependency.classpath for the classpath. My remote repository contains the dependency jars and the jars are found as you can see.
Anyone succeeded in running xdoclet inside maven?
Ara.
--- End Message ---
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
