Colin Sampaleanu wrote:
The url you mention below is talking about a pretty old verison of maven and xdoclet. It is almost trivially easy now, and in my opinion, easier although maybe a bit more verbose without the plugin. Just add to your project.xml proper dependencies for all the xdoclet artifacts you need, such as
<dependency>
<id>xdoclet:xdoclet</id>
<version>1.2b3-dev</version>
</dependency>
<dependency>
<id>xdoclet:xdoclet-jboss-module</id>
<version>1.2b3-dev</version>
</dependency>
etc. This will make sure all of xdoclet that is needed is available. These dependencies have to be satisfied from somewhere, and b3-dev in my case is not on ibiblio, so I have to satisfy it by adding to the local repo (in fact, what i actually do is have two remote repos instead (ibiblio and my own from cvs, and add xdoclet there).
Then, in your maven.xml file, do something like
<project
xmlns:j="jelly:core"
xmlns:maven="jelly:maven"
xmlns:log="jelly:log"
>
<!-- before the compile task, we want to copy some resource files
and generate source via xdoclet -->
<preGoal name="java:compile">
... some irrelevant stuff removed
<attainGoal name="gen-ejbs"/>
</preGoal>
<!-- split out ejb generation into separate goal -->
<goal name="gen-ejbs">
<taskdef name="ejbdoclet" classname="xdoclet.modules.ejb.EjbDocletTask">
<classpath>
<path refid="maven.dependency.classpath"/>
</classpath>
</taskdef>
<mkdir dir="${target.expejb.primary.dd.dir}"/>
<ejbdoclet destdir="${generated.java.dir}"
excludedtags="@version,@author"
ejbspec="2.0"
force="${xdoclet.force}">
... and so on, this is basically all the xdoclet ant stuff that you would use in your ant build.xml, although in my case I did try to reuse maven paths where possible, but since I was trying to build to the same locations as with my old ant-build it was a bit of a hybrid. The point it, just do what you did in ant, and make sure all the properties and paths are ok.
...
</ejbdoclet>
<!-- now add generated sources to maven compile set so maven knows to compile them -->
<path id="ejbdoclet.java.compile.src.set" location="${generated.java.dir}"/>
<maven:addPath id="maven.compile.src.set" refid="ejbdoclet.java.compile.src.set"/>
<!-- now, the ejb plugin can not handle getting the manifests from
where we generate them, so for the time being, just copy them -->
<copy todir="${maven.build.dest}">
<fileset dir="${target.expejb.primary.dir}">
</fileset>
</copy>
</goal>
</project>
Now, what would you have gotten if you used the plugin? Well, some base xdoclet dependencies would not have needed to be specified (xdoclet itself, xdoclet-xjavadoc), and doing a basic build with defaults would have required almost no settings anywhere else. As soon as you want to customize anything though, I think it is a lot harder, for the reasons mentioned in my initial email (xml vs. flat properties, mis-exposed properties, and case-sensitivity).
Hope this helps, Colin.
Roland Chan wrote:
Thanks for the reply Colin. Very useful information.
By using xdoclet directly in maven.xml, are you referring to something
like what this user's Xdoclet/Maven experience lead him to do?:
http://orinoco.flamefew.net/moatas/archives/000115.html
I have no experience working with the Maven.xml and the property file is
already looking painful.
Regards,
RC
-----Original Message-----
From: Colin Sampaleanu [mailto:[EMAIL PROTECTED]] Sent: January 31, 2003 3:41 PM
To: Turbine Maven Users List
Subject: Re: Xdoclet plugin: No goal [xdoclet:ejbdoclet]
You need to actually add the xdoclet plugin to your maven home plugin directory. Maven doesn't come with it. You can try the one from the the xdoclet 1.2 beta 2. However, if you are using maven CVS head, I would recommend actually building xdoclet against that. If you do do that, not
that the plugin will then have dependencies on 1.3b2, which you will have to satisfy yourself (ie they are not on ibiblio).
Having now used the xdoclet plugin and then gone back to just using xdoclet directly (in maven.xml), I would however advise you that as currently implemented the plugin doesn't really buy you almost anything,
and I find it more painful to use actually; it takes very simple xml hierarchichal ant tasks and makes you specify them as flat properties in
a prop file. Sure, there are a number of defaults, but if you want to change anything, it is actually more work. The other thing to watch out for there is that some of the properties are exposed under the wrong name (I filed a bug in the xdoclet Jira for this), and the only way you can really find out is by doing a compare to the xdoclet plugin's jelly file. In general, this is a problem with the whole property file approach to setting properties. If you have an xml document xdoclet can validate if something is missing, and doesn't care about case on attributes, but if you go the properties in a property file route, a mismatch (wrong name or wrong case) will be silently ignored.
All you really need to do is add a pregoal to java:compile, dump in your
existing ant built file's ejbdoclet section, and away you go (obviously you'll have to take care of paths). The other thing you do want to do is
add the generated source to the compile path, as follows:
<path id="ejbdoclet.java.compile.src.set" location="${generated.java.dir}"/>
<maven:addPath id="maven.compile.src.set" refid="ejbdoclet.java.compile.src.set"/>
Perhaps I will write a genral email on this, to save other people time.
Roland Chan wrote:
Hey gang,
Relatively new to Maven, but have experience with XDoclet..
I'm having difficulties getting the XDoclet plugin to work. I keep
receiving a No goal [xdoclet:ejbdoclet] error when trying to run
java:jar.
My dependencies look like this:
<dependencies>
<dependency>
<id>xdoclet+xdoclet-module</id>
<version>1.2b2</version>
</dependency>
<dependency>
<id>xdoclet+ejb-module</id>
<version>1.2b2</version>
</dependency>
<dependency>
<id>xdoclet+jboss-module</id>
<version>1.2b2</version>
</dependency>
<dependency>
<id>xdoclet+web-module</id>
<version>1.2b2</version>
</dependency>
<dependency>
<id>ejb</id>
<jar>ejb.jar</jar>
<version>2.0</version>
</dependency>
<dependency>
<id>commons-logging</id>
<version>1.1-dev</version>
</dependency>
<dependency>
<id>log4j</id>
<version>1.2.6</version>
</dependency>
</dependencies>
And my maven.xml and project.properties came straight off the web site.
Any ideas why this might be happening??
Thanks,
RC
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
