在網上搜了好久發現的都是些好舊的方法大多不能用了 今天瀏覽pom文件的時候忽然發現這麼一塊:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
<!-- Use 'jpaconfiguration' if you're using JPA. -->
<!--<implementation>jpaconfiguration</implementation> -->
</component>
</components>
<componentProperties>
<drop>true</drop>
<jdk5>true</jdk5>
<propertyfile>target/classes/jdbc.properties</propertyfile>
<skip>${skipTests}</skip>
</componentProperties>
</configuration>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
原來這個修改表的測試操作是可以跳過的,只要把上面的<skip>${skipTests}</skip>
中的${skipTests}
改成true就可以了,但是貌似更好的方法是在執行run或者install的命令的時候加一個參數,如下圖:
這樣就可以不用修改pom文件了,而且在需要的時候只要去掉這個參數就可方便的重新建立表結構了
不知道自己是不是又小白了…………貌似大蝦們都會這一步……= =!