[
http://jira.codehaus.org/browse/MOJO-855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_102975
]
Tim O'Brien commented on MOJO-855:
----------------------------------
I've tracked the problem down to Line 66 of the Hbm2JavaGenerator, this line
does the following:
getProject().addCompileSourceRoot( new File(
getComponent().getOutputDirectory() ).getPath();
So, try it, create a parent project, that has a subproject that uses the
hibernate3 plugin, then run "mvn hibernate3:hbm2java", you'll see that the
parent project will contain the generated class files.
I'm fixing this by adding a call to getProject().getBasedir(). I've tested
it, it works, I'll try to commit (not sure if I have karma....)
> Running hbm2ddl from parent POM generates code in parent's target directory
> ---------------------------------------------------------------------------
>
> Key: MOJO-855
> URL: http://jira.codehaus.org/browse/MOJO-855
> Project: Mojo
> Issue Type: Bug
> Components: hibernate3
> Environment: Windows, cygwin, Maven 2.0.7
> Reporter: Tim O'Brien
> Priority: Critical
>
> I have a parent POM and then five subprojects. In some of the subprojects
> I've bound hbm2java to the generate-sources phase. When I run maven from
> the parent project (i.e. when I run "mvn eclipse:eclipse" against the
> top-level POM), Maven executes hbm2java in the subproject, but the generated
> source files end up in the parent's target folder.
> Is the hibernate3 plugin writing generated sources to the right location?
> Parent POM has this plugin configuration. In it, I set the common location
> of the hibernate.cfg.xml file to "src/hibernate.cfg.xml". For each
> subproject, this file is found relative to the project's basedir.
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <snip....>
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>hibernate3-maven-plugin</artifactId>
> <version>2.0-SNAPSHOT</version>
> <configuration>
> <componentProperties>
> <drop>false</drop>
>
> <configurationfile>src/hibernate.cfg.xml</configurationfile>
> </componentProperties>
> </configuration>
> </plugin>
> </plugins>
> </build>
> <snip....>
> </project>
> Then in a POM which extends this parent, I'll add hbm2java to a lifecycle
> phase. Note, I need to do this because not all submodules generate Java from
> HBM. Some projects use Hibernate annotations:
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>hibernate3-maven-plugin</artifactId>
> <version>2.0-SNAPSHOT</version>
> <executions>
> <execution>
> <id>generate-ddl</id>
> <phase>process-classes</phase>
> <goals>
> <goal>hbm2ddl</goal>
> </goals>
> </execution>
> <execution>
> <id>generate-java</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>hbm2java</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
--
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email