Member Menu
 
 Monthly JBoss newsletter:
 
Hibernate Books
CaveatEmptor

Maven, XDoclet and Hibernate

The XDoclet for Hibernate plugin for Maven can be used to generate your mapping files.

You will need to add some properties to your project.properties.

maven.xdoclet.hibernatedoclet.destDir=${maven.build.dir}/xdoclet/hibernatedoclet
maven.xdoclet.hibernatedoclet.fileset.0=true
maven.xdoclet.hibernatedoclet.fileset.0.dir=${maven.src.dir}/java
maven.xdoclet.hibernatedoclet.fileset.0.include=**/*.java

By default the HibernateDoclet plugin generates mapping files for Hibernate 1.1. If you wish to create mapping files for Hibernate 2.0 add the following line to your project.properties file:

maven.xdoclet.hibernatedoclet.hibernate.0.Version=2.0

Now modify your maven.xml file to generate the mapping files when the code is compiled.

  <preGoal name="java:compile">
    <mkdir dir="${maven.xdoclet.hibernatedoclet.destDir}"/>
    <attainGoal name="xdoclet:hibernatedoclet"/>
  </preGoal>

If you now execute maven java:compile mapping files will be created in the target/xdoclet/hibernatedoclet directory.

It is helpful to keep these mapping files in the same place as the appropriate class files, this could be done by altering the maven.xdoclet.hibernatedoclet.destDir property, or by altering the maven.xml to copy the files appropriately i.e.

  <preGoal name="java:jar-resources">
    <echo message="${maven.build.dest}"/>
    <copy todir="${maven.build.dest}">
      <fileset dir="${maven.xdoclet.hibernatedoclet.destDir}"/>
    </copy>
  </preGoal>
                                                                                
  <preGoal name="test:test-resources">
    <copy todir="${maven.test.dest}">
      <fileset dir="${maven.xdoclet.hibernatedoclet.destDir}"/>
    </copy>
  </preGoal>

  NEW COMMENT

Dependencies 28 Dec 2003, 00:18 robd
I kept on getting the following build error: taskdef class
xdoclet.modules.hibernate.HibernateDocletTask. I found the solution was
to ensure the following two dependencies were included in my project.xml
file.

<dependency>
<groupId>xdoclet</groupId>
<artifactId>xdoclet-hibernate-module</artifactId>
<version>1.2</version>
</dependency>

<dependency>
<groupId>xdoclet</groupId>
<artifactId>xjavadoc</artifactId>
<id>xjavadoc</id>
<version>1.0.2</version>
</dependency>
 
dependency correction / case sensitivity 30 Dec 2003, 03:39 robd
In my last comment, the id attribute of the second dependency was bogus,
and not needed. I also found that due to dependencies of
maven-xdoclet-plugin-1.2.jar, I had to copy xjavadoc-1.0.2.jar from
$HOME/.maven/repository/xdoclet/jars to
$HOME/.maven/repository/xjavadoc/jars

I found that the destDir property is case sensitive under win2k + cygwin. 
setting maven.xdoclet.hibernatedoclet.destdir had no effect on the
location of the output mapping files, but setting 
maven.xdoclet.hibernatedoclet.destDir=${maven.build.dest} worked.
 
care to publish the whole maven.xml for our benefit? 04 Mar 2004, 13:46 grrrrr
I find this functionality is exactly what i need but doesn't quite close
the gap on my understanding of how to implement or what steps occur to
arrive at a final outcome of having a mapping file and DDL and a dbms test.
 
The dependencies for xdoclet 07 Mar 2004, 01:32 jpratt
Here are the dependencies that will get you through most uses. I am 
currently using this for Hibernate, jBoss, Struts, EJB's and support 
files.  Hope this helps...


	<!-- XDoclet dependencies -->
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xjavadoc</artifactId>
				<version>1.0.2</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-xdoclet-
module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-ejb-module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-web-module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-jmx-module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-web-module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-jboss-
module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>
			
			<dependency>
				<groupId>xdoclet</groupId>
				<artifactId>xdoclet-apache-
module</artifactId>
				<version>1.2b4</version>
				<url>http://xdoclet.sourceforge.net</url>
			</dependency>

			<dependency> 
				<groupId>xdoclet</groupId> 
				<artifactId>xdoclet-hibernate-
module</artifactId> 
				<version>1.2</version> 
			</dependency> 
<!-- end of xdoclet -->
 
XDoclet maven plugin installation 21 Mar 2004, 22:21 bvoisin
If you have a BUILD FAILED because of "No goal 
[xdoclet:hibernatedoclet]" like I did, the xdoclet plugin is probably 
not installed. To install it, run :

maven plugin:download -DartifactId=maven-xdoclet-plugin -
DgroupId=xdoclet -Dversion=1.2

There might be other(better ?) ways, but that's the first one I found.
Ben
 
nested plugin housings 16 Jun 2004, 16:50 libereco
What if you get the message 'nested plugin housings'? As a Maven newbie
I have no clue what so ever to handle this message. Any ideas?

Marcel
 
Getting plugin to work 27 Jul 2004, 04:43 ryanch
If you add the following to you project.xml file, it will include the
required deps to run this goal- at least it did for me :)

<dependency>
	<groupId>xdoclet</groupId>
	<artifactId>xjavadoc</artifactId>
	<version>1.0.2</version>
	<url>http://xdoclet.sourceforge.net</url>
</dependency>
<dependency> 
	<groupId>xdoclet</groupId> 
	<artifactId>xdoclet-hibernate-module</artifactId> 
	<version>1.2</version> 
</dependency> 	
<dependency> 
	<groupId>xdoclet</groupId> 
	<artifactId>maven-xdoclet-plugin</artifactId> 
	<version>1.2</version> 
	<type>plugin</type> 
</dependency>
 
Tag library requested that is not present: 'maven' 31 Aug 2004, 13:20 dannyor
I think I use everything according to the above. Still, the only thing
hibernatedoclet gives me is the following error:

Tag library requested that is not present: 'maven' in plugin:
'maven-xdoclet-plugin-1.2.1'
I use xdoclet 1.2.1 with plugin 1.2.1

Has anyone seen this ?
 
Maven-XDoclet Plugin and Hibernate CFG generation 11 Nov 2004, 20:06 bumble
Hi,

Does anyone know how to generate the hibernate.cfg.xml file with
maven-xdoclet plugin? I mean, the maven-equivalent of <hibernatecfg/>
sub-task of hibernatedoclet?

Unfortunately, there is a very poor documentation about the properties
used by the plugin...

Thanks,
Renaud
 
Re: Tag library requested that is not present: 'maven' 16 Nov 2004, 19:20 tpolicy
On 31 Aug 2004 13:20, dannyor wrote:

>I think I use everything according to the above. Still, the only thing
>hibernatedoclet gives me is the following error:

>Tag library requested that is not present: 'maven' in plugin:
>'maven-xdoclet-plugin-1.2.1'
>I use xdoclet 1.2.1 with plugin 1.2.1

>Has anyone seen this ?

Have you gotten a reply on this?  I too see the same thing and have no 
idea how to resolve it.
 
making plugin installation automatic 23 Dec 2004, 12:05 caoilte
To make maven bootstrap its hibernatedoclet build (I mean that's why 
you use it) put the following into your maven.xml file. 
 
{{{<preGoal name="java:compile"> 
    <j:set var="groupId" value="xdoclet"/> 
    <j:set var="artifactId" value="maven-xdoclet-plugin"/> 
    <j:set var="version" value="1.2"/> 
    <attainGoal name="plugin:download-artifact"/> 
    <m:installPlugin 
file="${maven.repo.local}/${groupId}/plugins/${artifactId}-${version}.jar" 
cache="true" /> 
 
    <attainGoal name="xdoclet:hibernatedoclet"/> 
  </preGoal>}}} 
 
This will make maven install the xdoclet plugin if it isn't already 
and allows your build to work straight out of the (repository) box.  
 
NB I use 1.2.2 but that isn't in the iblibio repository (yet) so if 
you want to too you'll need to make your own repository.
 
Tag library requested that is not present: 'maven' in plugin:... 17 Mar 2006, 00:57 big.house.rutherford
Following is the output I first received, which is comparable to the
problem others mentioned:

Tag library requested that is not present: 'maven' in plugin:
'maven-xdoclet-plugin-1.2'
java.lang.NoSuchMethodError:
xjavadoc.XClass.getTransformedName()Ljava/lang/String;


The 'NoSuchMethodError' of the xjavadoc lib implies the signature is not
available in that xjavadoc library.  So, I updated that jar to version
1.1, as opposed to the 1.0.2 as mentioned above in dependencies.  It worked.

Your config may not require this specific change, but this error (and
java errors in general) could very well be caused by incompatible lib
versions, or even subversions.

best...
 
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]