The following issue has been updated: Updater: Felipe Leme (mailto:[EMAIL PROTECTED]) Date: Sun, 12 Dec 2004 5:58 PM Comment: Paul,
I did some minor modifications in the testcases and the patch is almost done. Still, I think it needs some more features before it can be applied: - we need to tell the plugin which classes should or should not be generated. For instance, the current test case is regenerating the Item.java from Item.hbm.xml. In other words, we need a exclude/include pair of properties (something like maven.hibernate.generated.input.includes) - also, the new goal should automaticaly add maven.hibernate.generated.output.dir to the src set expected by java:compile. I added 2 lines to teh tag, but I'm nto sure if that's the right way to do it (I mean, we should be doing that in the Java class, not in the Jelly script). Also, the test case is failing because now we have some duplicated Java files (see item above) Anyway, I'm attaching the new patch (patch-felipeal-1). Thanks, Felipe PS: to run the test-cases, simply type 'maven plugin:test' at the hibernate directory properties Changes: Attachment changed to patch-felipeal-1 --------------------------------------------------------------------- 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: Sun, 12 Dec 2004 5:58 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]