Search code examples
eclipsemavenmaven-3m2e

Issue with the lifecyle of Hibernate3 Maven plugin


I want to use the Hibernate3 maven plugin in one of my projects. But, because m2e doesn't have a lifecycle configurator for it, I need to configure the lifecycle plugin to ignore the plugin execution. But, I also use the maven dependency plugin which is also not supported by m2e AFAIK.

So, the configuration of my lifecycle plugin is:

<plugin>
    <groupId>org.eclipse.m2e</groupId>
    <artifactId>lifecycle-mapping</artifactId>
    <configuration>
        <lifecycleMappingMetadata>
            <pluginExecutions>
                <pluginExecution>
                    <pluginExecutionFilter>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-dependency-plugin</artifactId>
                            <versionRange>[2.0,)</versionRange>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                    </pluginExecutionFilter>
                    <action>
                        <ignore />
                    </action>
                </pluginExecution>
                <pluginExecution>
                    <pluginExecutionFilter>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>hibernate3-maven-plugin</artifactId>
                            <versionRange>[3.0,)</versionRange>
                            <goals>
                                <goal>hbm2ddl</goal>
                            </goals>
                    </pluginExecutionFilter>
                    <action>
                        <ignore />
                    </action>
                </pluginExecution>
            </pluginExecutions>
        </lifecycleMappingMetadata>
    </configuration>
</plugin>

The problem is that when I use the Hibernate3 plugin in my project, I get the error "Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (execution: schema-generation, phase: process-classes)" at the line. Note that I don't get this error at the line where I use the maven dependency plugin.

Any idea?

Thanks


EDIT: The hbm2ddl goal of the Hibernate3 plugin was bind to the process-classes phase. I've changed the phase to package (just to try) and I didn't get the error. Any explanation? To which phase the hbm2ddl goal should be bind?


Solution

  • You have to add a phase which means you have to enhance your configuration like the following:

     <pluginExecutionFilter>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>hibernate3-maven-plugin</artifactId>
       <versionRange>[3.0,)</versionRange>
       <phase>process-classes</phase>
       <goals>
         <goal>hbm2ddl</goal>
       </goals>
     </pluginExecutionFilter>