29 1月 2007

Use xdoclet2 hibernate plugin in Maven2

(1) Add pluginRepositories element to your pom.xml
<project>
 <pluginRepositories>
  <pluginRepository>
   <id>codehaus-plugins</id>
   <url>http://dist.codehaus.org/</url>
   <layout>legacy</layout>
   <snapshots>
    <enabled>true</enabled>
   </snapshots>
   <releases>
    <enabled>true</enabled>
   </releases>
  </pluginRepository>
 </pluginRepositories>
</project>
(2) Add xdoclet2 plugin to pom.xml
<plugins>
 <plugin>
  <groupId>xdoclet</groupId>
  <artifactId>maven2-xdoclet2-plugin</artifactId>
  <executions>
   <execution>
    <id>xdoclet</id>
    <phase>generate-sources</phase>
    <goals>
     <goal>xdoclet</goal>
    </goals>
   </execution>
  </executions>
  <dependencies>
   <dependency>
    <groupId>xdoclet-plugins</groupId>
    <artifactId>
     xdoclet-plugin-hibernate
    </artifactId>
    <version>1.0.4-SNAPSHOT</version>
   </dependency>
  </dependencies>
  <configuration>
   <configs>
    <config>
     <components>
      <component>
       <classname>
        org.xdoclet.plugin.hibernate.HibernateMappingPlugin
       </classname>
      </component>
     </components>
     <params>
      <version>3.0</version>
     </params>
    </config>
   </configs>
  </configuration>
 </plugin>
</plugins>
(3) Run mvn compile

Technorati Tags: , ,

沒有留言: