我有两个要生成hbm2java的数据库。
<project>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version> 2.2</version>
<executions>
<execution>
<id>db1</id>
<configuration>
<components>
<component>
<name>hbm2java</name>
...
</component>
</components>
<componentProperties>
...
<configurationfile>.../hibernate1.cfg.xml</configurationfile>
</componentProperties>
</execution>
<execution>
<id>db2</id>
<configuration>
<components>
<component>
<name>hbm2java</name>
...
</component>
</components>
<componentProperties>
...
<configurationfile>.../hibernate2.cfg.xml</configurationfile>
</componentProperties>
</execution>
</executions>
...
</plugin>
...
</plugins>
...
</project>好的,如果我运行mvn hibernate3:hbm2java,那么它不会执行任何操作!
这是日志:
[INFO] >>> hibernate3-maven-plugin:2.2:hbm2java (default-cli) @ XXXXXXXXXXXXX >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ XXXXXXXXXXXXX ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] <<< hibernate3-maven-plugin:2.2:hbm2java (default-cli) @ XXXXXXXXXXXXX <<<
[INFO]
[INFO] --- hibernate3-maven-plugin:2.2:hbm2java (default-cli) @ XXXXXXXXXXXXX ---
[INFO] using configuration task.
11:07:29,370 INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
11:07:29,376 INFO org.hibernate.cfg.Environment - hibernate.properties not found
11:07:29,381 INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
11:07:29,387 INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[INFO] No hibernate configuration file loaded.
[INFO] No hibernate properties file loaded.
11:07:29,464 INFO org.hibernate.tool.Version - Hibernate Tools 3.2.4.GA
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------有什么想法吗?
发布于 2013-04-22 18:38:19
好吧,我不能通过生命周期来分离hbm2java的执行。
我有一个使用自定义配置文件“generate”的解决方案:
<project>
<profiles>
<profile>
<id>generate</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>db1</id>
<configuration>
<components>
<component>
<name>hbm2java</name>
...
</component>
</components>
<componentProperties>
...
<configurationfile>.../hibernate1.cfg.xml</configurationfile>
</componentProperties>
</execution>
<execution>
<id>db2</id>
<configuration>
<components>
<component>
<name>hbm2java</name>
...
</component>
</components>
<componentProperties>
...
<configurationfile>.../hibernate2.cfg.xml</configurationfile>
</componentProperties>
</execution>
</executions>
...
</plugin>
...
</plugins>
</build>
</profile>
</profiles>
...
</project>现在我需要执行3种不同的执行:
mvn install -Dmaven.test.skip=true编译reverse-engineer-strategymvn compile -P generate生成类mvn test测试单元测试发布于 2013-04-22 17:14:36
exeuctions仅与生命周期相关,这意味着您必须调用:
mvn process-resources而不是简单地调用插件的目标。或更晚的阶段,如:
mvn compilehttps://stackoverflow.com/questions/16143294
复制相似问题