The following comment has been added to this issue: Author: Paul Kearney Created: Mon, 20 Dec 2004 6:57 PM Body: Felipe,
The current plugin.jelly does support the exclusion of files from being generated. If you set maven.hibernate.input.excludes = org/apache/maven/hibernate/Item.hbm.xml then this should exclude the Item.java from being generated. This just re-uses existing properties and I agree it may well be clearer to provide hbm generation specific properties rather than reusing existing ones. Both maven.hibernate.input.includes and maven.hibernate.input.excludes are reused in the plugin.jelly I submitted. The second point regarding the addition of the generated source to the src set expected by the java:compile target I am not sure about. For one this sounds like it may require overriding the class loader (something I have never attempted before), but it also strikes me as being beyond the scope of the plugin. It makes an assumption that everyone using the plugin will run java:compile after the code is generated. Would it not be more sensible to allow the person using the plugin to add the generated source directory to their java:compile set by configuring the maven.compile.src.set property of the java plugin. Personally, I set the maven.hibernate.generated.output.dir property to point to my projects java source directory (not that I am suggesting everyone should have to do this, but it does make sense to me). Let me know if you agree or not. Paul --------------------------------------------------------------------- View this comment: http://jira.codehaus.org/browse/MPHIBERNATE-12?page=comments#action_28234 --------------------------------------------------------------------- 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: Mon, 20 Dec 2004 6:57 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]