[
http://jira.codehaus.org/browse/MOJO-855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim O'Brien closed MOJO-855.
----------------------------
Assignee: Tim O'Brien
Resolution: Fixed
Fairly straightforward bug fix, just had to add getProject().getBasedir().
Tested hbm2java with a multiproject and it works swimmingly:
Modified:
trunk/mojo/maven-hibernate3/hibernate3-maven-plugin/src/main/java/org/codehaus/mojo/hibernate3/HibernateExporterMojo.java
(4634 => 4635)
---
trunk/mojo/maven-hibernate3/hibernate3-maven-plugin/src/main/java/org/codehaus/mojo/hibernate3/HibernateExporterMojo.java
2007-07-23 15:39:53 UTC (rev 4634)
+++
trunk/mojo/maven-hibernate3/hibernate3-maven-plugin/src/main/java/org/codehaus/mojo/hibernate3/HibernateExporterMojo.java
2007-07-23 15:56:40 UTC (rev 4635)
@@ -184,7 +184,7 @@
exporter.setProperties( properties );
exporter.setConfiguration( componentConfiguration.getConfiguration(
this ) );
- exporter.setOutputDirectory( new File(
getComponent().getOutputDirectory() ) );
+ exporter.setOutputDirectory( new File( getProject().getBasedir(),
getComponent().getOutputDirectory() ) );
return exporter;
}
Modified:
trunk/mojo/maven-hibernate3/hibernate3-maven-plugin/src/main/java/org/codehaus/mojo/hibernate3/exporter/Hbm2JavaGeneratorMojo.java
(4634 => 4635)
---
trunk/mojo/maven-hibernate3/hibernate3-maven-plugin/src/main/java/org/codehaus/mojo/hibernate3/exporter/Hbm2JavaGeneratorMojo.java
2007-07-23 15:39:53 UTC (rev 4634)
+++
trunk/mojo/maven-hibernate3/hibernate3-maven-plugin/src/main/java/org/codehaus/mojo/hibernate3/exporter/Hbm2JavaGeneratorMojo.java
2007-07-23 15:56:40 UTC (rev 4635)
@@ -63,7 +63,7 @@
throws MojoExecutionException
{
// add output directory to compile roots
- getProject().addCompileSourceRoot( new File(
getComponent().getOutputDirectory() ).getPath() );
+ getProject().addCompileSourceRoot( new File(
getProject().getBasedir(), getComponent().getOutputDirectory() ).getPath() );
// now set the extra properties for the POJO Exporter
POJOExporter exporter = (POJOExporter) super.configureExporter( exp );
> 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
> Assignee: 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