2012-08-28 1 views
1

Lorsque je lance mvn hibernate3: hbm2cfgxml il ne génère pas de fichier hibernate.cfg.xml. Cependant, il génère des pojos et des daos mais ne génère pas de fichier hibernate.cfg.xml.hibernate.cfg.xml n'est pas créé même lorsque je lance mvn hibernate3: hbm2cfgxml

Voici mon fichier pom.xml.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org /2001/XMLSchema-instance"= xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>com.myhadoop.app</groupId> 
<artifactId>my-app-hadoop</artifactId> 
<packaging>jar</packaging> 
<version>1.0-SNAPSHOT</version> 
<name>my-app-hadoop</name> 
<url>http://maven.apache.org</url> 

<dependencies> 
<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>3.8.1</version> 
    <scope>test</scope> 
</dependency> 

<dependency> 
    <groupId>org.apache.hadoop</groupId> 
    <artifactId>hadoop-core</artifactId> 
    <version>1.0.3</version> 
</dependency> 

<dependency> 
    <groupId>org.hibernate </groupId> 
    <artifactId>hibernate-core</artifactId> 
    <version>4.1.6.Final</version> 
</dependency> 

<dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>servlet-api</artifactId> 
    <version>3.0-alpha-1</version> 
</dependency> 

<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-simple</artifactId> 
    <version>1.6.6</version> 
</dependency> 

<dependency> 
    <groupId>javassist</groupId> 
    <artifactId>javassist</artifactId> 
    <version>3.12.1.GA </version> 
</dependency> 
</dependencies> 
<repositories> 
<repository> 
    <id>jBoss-Repository</id> 
    <url>https://repository.jboss.org/nexus/content/groups/public/</url> 
    <releases> 
     <enabled>true</enabled> 
    </releases> 
    <snapshots> 
     <enabled>false</enabled> 
    </snapshots>   
</repository> 
<repository> 
    <id>mirrors.ibiblio</id> 
    <url>http://mirrors.ibiblio.org/maven/mule/dependencies/maven2/</url> 
    <releases> 
     <enabled>true</enabled> 
    </releases> 
    <snapshots> 
     <enabled>false</enabled> 
    </snapshots>   
</repository> 
</repositories> 
<build> 
<plugins> 
    <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>hibernate3-maven-plugin</artifactId> 
     <version>2.2</version> 
     <configuration> 
      <components> 
       <component> 
        <name>hbm2ddl</name> 
         <implementation>jdbcconfiguration</implementation> 
       </component> 
       <component> 
        <name>hbm2hbmxml</name> 
        <implementation>jdbcconfiguration</implementation> 
        <outputDirectory>src/main/java/org/dbmxml</outputDirectory> 
       </component> 
       <component> 
        <name>hbm2dao</name> 
        <implementation>jdbcconfiguration</implementation> 
        <outputDirectory>src/main/java</outputDirectory> 
       </component> 
       <component> 
        <name>hbm2java</name> 
        <implementation>jdbcconfiguration</implementation> 
        <outputDirectory>src/main/java</outputDirectory> 
       </component> 

       <component> 
        <name>hbm2doc</name> 
        <implementation>jdbcconfiguration</implementation> 
        <outputDirectory>src/hbm2doc</outputDirectory> 
       </component> 

       <component> 
        <name>hbm2ddl</name> 
        <implementation>jdbcconfiguration</implementation> 
        <outputDirectory>src/hbm2ddl</outputDirectory> 
       </component> 
      </components> 

      <componentProperties> 
       <drop>true</drop> 
       <packagename>org.hbm2dao</packagename> 
       <configurationfile>/src/main/resources/hibernate.cfg.xml</configurationfile> 
       <propertyFile>/src/main/resources/database.properties</propertyFile> 
      </componentProperties> 
     </configuration> 
     <dependencies> 
      <dependency> 
       <groupId>com.oracle</groupId> 
       <artifactId>ojdbc</artifactId> 
       <version>6</version> 
       <scope>system</scope> 
       <systemPath>D:/apps/oracle11g/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6.jar</systemPath> 
     </dependency> 
    </dependencies> 
    </plugin> 
</plugins> 

Ce qui doit être ajouté dans pom.xml afin que je puisse générer un fichier hibernate.cfg.xml.

Répondre

1

Basé sur le documentation vous devez créer une partie comme ce qui suit:

<component> 
    <name>hbm2cfgxml</name> 
    <implementation>...</implementation> 
    ... 
</component> 
+0

+1 Merci cela a fonctionné. –

Questions connexes