I am using Maven 2.0.4.  I added a hibernate3 plugin to my build, and expected to run hbm2java at the generate-resources phase, but maven tries to compile before generating the java source from the hbm files.  My configuration looks as follows:

 

 

 

          <plugin>

              <groupId>org.codehaus.mojo</groupId>

              <artifactId>hibernate3-maven-plugin</artifactId>

          

             <executions>

                <execution>

                  <phase>generate-sources</phase>

                  <goals>

                    <goal>hbm2java</goal>

                  </goals>

                 

                  <configuration>

                     <hibernate>

                       <propertyFile>/src/main/resources/hibernate/hibernate.cfg.sqlserver.properties</propertyFile>

                     </hibernate>

                     <outputDirectory>

                       <hbm2cfgxml>src/main/resources</hbm2cfgxml>

                      </outputDirectory>

                   </configuration>

                </execution>

              </executions>

          </plugin>

 

The build fails because the java files were not generated in the generate-sources phase:

 

 

C:\brg_dev\dip7\hibernate_sample>mvn compile

 

[INFO] Scanning for projects...

Downloading: http://repo1.maven.org/maven2/jdbc/sqlserver/jtds/jtds/1.2/jtds-1.2.pom

[WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2)

[INFO]

----------------------------------------------------------------------------

[INFO] Building Maven Quick Start Archetype

[INFO]    task-segment: [compile]

[INFO]

----------------------------------------------------------------------------

[INFO] Preparing hibernate3:hbm2java

[WARNING] Removing: hbm2java from forked lifecycle, to prevent recursive invocation.

[INFO] [resources:resources]

[INFO] Using default encoding to copy filtered resources.

[WARNING]         Artifact junit:junit:jar:3.8.1:test retains local scope 'test'

overriding broader scope 'compile' given by a dependency. If this is not intended, modify or remove the local scope.

 

[INFO] [compiler:compile]

Compiling 1 source file to C:\brg_dev\dip7\hibernate_sample\target\classes

[INFO]

------------------------------------------------------------------------

[ERROR] BUILD FAILURE

[INFO]

------------------------------------------------------------------------

[INFO] Compilation failure

 

C:\brg_dev\dip7\hibernate_sample\src\main\java\com\horizon\hibernate\sample\

UsersHelper.java:[3,0] package hw_security.hibernate does not exist

 

C:\brg_dev\dip7\hibernate_sample\src\main\java\com\horizon\hibernate\sample\

UsersHelper.java:[13,49] cannot find symbol \

symbol  : class User

 

location: class com.horizon.hibernate.sample.UsersHelper

 

 

[INFO]

------------------------------------------------------------------------

[INFO] For more information, run Maven with the -e switch

[INFO]

------------------------------------------------------------------------

[INFO] Total time: 2 seconds

[INFO] Finished at: Wed May 03 10:36:46 EDT 2006

[INFO] Final Memory: 5M/12M

[INFO]

------------------------------------------------------------------------

 

 

 

Any ideas on this?   I really appreciate the help,

 

 

Cristian Jansenson


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 5/4/2006

Reply via email to