[英]hibernate3-maven-plugin Plugin execution not covered by lifecycle configuration Error in Eclipse
I'm trying to use the hibernate3-maven-plugin to read the JPA entites in my persistence.xml and create the DDL database script so that I can insert my tables into my database. 我正在尝试使用hibernate3-maven-plugin读取我的persistence.xml中的JPA实体,并创建DDL数据库脚本,以便可以将表插入数据库中。 The first maven plugin configuration below works and creates the DDL script but the pom.xml has an annoying lifecycle configuration error when viewing it in Eclipse.
下面的第一个maven插件配置可以工作并创建DDL脚本,但是pom.xml在Eclipse中查看时会出现一个烦人的生命周期配置错误。 I attempted to use the second configuration of the plugin below (the one with the lifecycleMappingMetadata) but it doesn't create the DDL script and doesn't throw any erros when I mvn clean install.
我尝试使用下面的插件的第二种配置(一个带有lifecycleMappingMetadata的配置),但它不会创建DDL脚本,并且在我执行mvn clean install时不会抛出任何错误。 Any ideas?
有任何想法吗?
Eclipse XML Validation Error: Eclipse XML验证错误:
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl (execution: default, phase:
compile)
Works but has Eclipse XML Validation lifecycle configuration Error: 可以,但是具有Eclipse XML Validation生命周期配置错误:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>jpaconfiguration</implementation>
</component>
</components>
<componentProperties>
<persistenceunit>myapi</persistenceunit>
<outputfilename>my.sql</outputfilename>
<drop>false</drop>
<create>true</create>
<export>false</export>
<format>true</format>
</componentProperties>
</configuration>
</plugin>
lifecycleMappingMetadata that doesn't work: lifecycleMappingMetadata不起作用:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<versionRange>[2.2,)</versionRange>
<phase>compile</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
<components>
<component>
<name>hbm2ddl</name>
<implementation>jpaconfiguration</implementation>
</component>
</components>
<componentProperties>
<persistenceunit>denaliapi</persistenceunit>
<outputfilename>denali.sql</outputfilename>
<drop>false</drop>
<create>true</create>
<export>false</export>
<format>true</format>
</componentProperties>
</configuration>
</plugin>
The lifecycle mapping that should be ignored is m2e's, not hibernate3's. 应该忽略的生命周期映射是m2e,而不是hibernate3。 Use your first block to configure hibernate-maven3, and use this block for m2e:
使用您的第一个块来配置hibernate-maven3,并将此块用于m2e:
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<versionRange>[2.2,)</versionRange>
<goals>
<goal>hbm2ddl</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
If the DDL is not being generated after that change, try changing the <ignore/>
to <execute/>
. 如果更改之后没有生成DDL,请尝试将
<ignore/>
更改为<execute/>
。
(Aside: The Ctrl+1 suggestion that @gerrytan made works in Kepler. Is your caret on the line with the error?) (此外:Ctrl + 1建议@gerrytan在Kepler中起作用。您的插入符是否出现错误?)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.