The following issue has been updated:
Updater: Paul Kearney (mailto:[EMAIL PROTECTED])
Date: Tue, 7 Dec 2004 6:21 PM
Comment:
Zip inlcudes plugin.jelly etc
Changes:
Attachment changed to maven-plugins.zip
---------------------------------------------------------------------
For a full history of the issue, see:
http://jira.codehaus.org/browse/MPHIBERNATE-12?page=history
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/MPHIBERNATE-12
Here is an overview of the issue:
---------------------------------------------------------------------
Key: MPHIBERNATE-12
Summary: Adding POJO from hbm file code generation feature to plugin
Type: New Feature
Status: Unassigned
Priority: Major
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: maven-hibernate-plugin
Assignee:
Reporter: Paul Kearney
Created: Tue, 2 Nov 2004 4:56 PM
Updated: Tue, 7 Dec 2004 6:21 PM
Environment: N/A
Description:
I have added a feature to my local version of the hibernate plugin which I
thought might be worthy of inclusion in a future version.
In the projects I work on there is a need to generate POJOs classes from
hibernate hbm files and I have adapted and incorportated an old ant script into
our maven-hibernate plugin to do this.
In order to add this goal all you have to do is:
1. Add the following to project.xml:
<dependency>
<groupId>hibernate-extensions</groupId>
<artifactId>hibernate-tools</artifactId>
<version>2.1.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
2.
Add the following goal to the plugin.jelly
<goal name="hibernate:hbm-code-generation" prereqs="hibernate:init"
description="Generate POJOs from hbm files">
<ant:echo>Generating POJOs from hbm files</ant:echo>
<ant:fileset id="hbm.fileset"
dir="${maven.hibernate.generated.input.dir}"
includes="${maven.hibernate.input.includes}"/>
<ant:pathconvert property="hbm.files" refid="hbm.fileset" pathsep=" "/>
<ant:java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator"
failonerror="true">
<ant:classpath>
<ant:pathelement
location="${plugin.getDependencyPath('hibernate-extensions:hibernate-tools')}"/>
<ant:pathelement
location="${plugin.getDependencyPath('commons-collections:commons-collections')}"/>
<ant:pathelement
location="${plugin.getDependencyPath('commons-logging:commons-logging')}"/>
<ant:pathelement
location="${plugin.getDependencyPath('jdom:jdom')}"/>
<ant:path refid="maven.dependency.classpath"/>
</ant:classpath>
<ant:arg
value="--output=${maven.hibernate.generated.output.dir}"/>
<ant:arg line="${hbm.files}"/>
</ant:java>
</goal>
3.
Add the following properties to the plugin.properties
maven.hibernate.generated.input.dir=${maven.src.dir}/conf/hibernate
maven.hibernate.generated.output.dir=${maven.src.dir}/java
4.
Ensure that hibernate-tools-2.1.2.jar is available at ibiblio.
It should now be possible to generate POJOs from hbm files. The POJOs will be
placed in the src/java directory by default.
I am in the process of carrying out Step 4 myself and will hopefully do this
soon.
Hope you find this worth consideration and hopefully it can make it into a
future release.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]