当我第一次建立我的项目时,我已经知道如果它不停止做两次事情,现在是时候了,我会疯掉的。我还没有找到解决办法,或者我只是不知道如何去寻找这个问题。
我有一些hbm.xml文件在我的构建过程中被处理。首先,您可以看看我的pom.xml部分,它应该能做到这一点。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>generate-xml-files</id>
<phase>generate-resources</phase>
<goals>
<goal>hbm2cfgxml</goal>
</goals>
</execution>
<execution>
<id>generate-entities</id>
<phase>generate-resources</phase>
<goals>
<goal>hbm2java</goal>
</goals>
</execution>
<execution>
<id>generate-schema</id>
<phase>compile</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<configuration>
<components>
<component>
<name>hbm2cfgxml</name>
<implementation>configuration</implementation>
<outputDirectory>target/classes</outputDirectory>
</component>
<component>
<name>hbm2java</name>
<implementation>configuration</implementation>
<outputDirectory>src/main/java</outputDirectory>
</component>
<component>
<name>hbm2ddl</name>
<implementation>configuration</implementation>
<outputDirectory>target/classes</outputDirectory>
</component>
</components>
<componentProperties>
<jdk5>true</jdk5>
<packagename>com.blazebit.web.cms.core.model</packagename>
<propertyfile>src/main/resources/database.properties</propertyfile>
<configurationfile>target/classes/hibernate.cfg.xml</configurationfile>
<!-- Tells the plugin to send the output to a file -->
<outputfilename>schema.sql</outputfilename>
<!-- Pretty Format SQL Code -->
<format>true</format>
<!-- Do not create tables automatically - other plug-ins will handle that -->
<export>false</export>
<!-- Do not print the DDL to the console -->
<console>false</console>
</componentProperties>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.8</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.blazebit</groupId>
<artifactId>HibernateCfgBuilder</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>HibernateCfgBuilder</id>
<phase>generate-sources</phase>
<goals>
<goal>HibernateCfgBuilder</goal>
</goals>
</execution>
</executions>
<configuration>
<hbmXmlFilesDir>src/main/resources/com/blazebit/web/cms/core/model/</hbmXmlFilesDir>
<configFile>target/classes/hibernate.cfg.xml</configFile>
<packageName>com.blazebit.web.cms.core.model</packageName>
</configuration>
</plugin>现在让我解释一下这一切应该做些什么。
听起来很简单?它甚至可以工作,但它似乎做了两次甚至更多的事情,现在我的构建大约需要2分钟,这让我很烦恼:/有人能给我一个提示,说明我可以改变什么来使这个步骤工作吗?
发布于 2011-07-06 05:54:29
我认为它将某些目标称为两次,因为一些hibernate3-maven-plugin目标是“调用生命周期阶段的执行--在执行自身之前生成资源”,如文档中所述。。我也面临着这个问题,如果它真的惹恼了您,那么我建议尝试将它们称为来自maven-antrun-plugin的Ant目标(但我不测试这个)。
https://stackoverflow.com/questions/6576533
复制相似问题