2017-01-06 5 views
0

を静的なメタモデルを生成しました。 しかし私の問題は、DAOImplのような私の他のクラスは、これらのメタモデル生成クラスを認識しないということです。。助けてください?ここでMavenは、私が<strong>正常に生成メタモデル</strong>を持っているし、すべてのメタモデルクラスが<strong>ターゲット/注釈</strong>ディレクトリに出力されたDAOクラスによって認識されない休止5.2で

は、私は私のMavenプロジェクトのpom.xmlファイルを使用してメタモデルを生成する方法である:

<plugin> 
    <groupId>org.bsc.maven</groupId> 
    <artifactId>maven-processor-plugin</artifactId> 
    <executions> 
    <execution> 
     <id>process</id> 
     <goals> 
     <goal>process</goal> 
     </goals> 
     <phase>generate-sources</phase> 
     <configuration> 
     <processors> 
      <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor> 
     </processors> 
     </configuration> 
    </execution> 
    </executions> 
    <dependencies> 
    <dependency>   
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-jpamodelgen</artifactId> 
     <version>4.3.4.Final</version> 
    </dependency> 
    </dependencies> 
</plugin> 
+0

プロジェクトの構造を追加してください。 –

答えて

0

あなたは、このチェックを設定しているん:

<plugin> <!--Compiler instructions to generate model, add to sources.--> 

    <artifactId>maven-compiler-plugin</artifactId> 

    <configuration> 

     <source>1.6</source> 

     <target>1.6</target> 

     <compilerArguments> 

      <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor> 

     </compilerArguments> 

    </configuration> 

</plugin> 


<plugin><!--path were to generate model, add to --> 

    <groupId>org.bsc.maven</groupId> 

    <artifactId>maven-processor-plugin</artifactId> 

    <executions> 

     <execution> 

      <id>process</id> 

      <goals> 

       <goal>process</goal> 

      </goals> 

      <phase>generate-sources</phase> 

      <configuration> 

       <!-- source output directory --> 

       <outputDirectory>target/metamodel</outputDirectory> 

      </configuration> 

     </execution> 

    </executions> 

</plugin> 

<plugin> 

    <groupId>org.codehaus.mojo</groupId> 

    <artifactId>build-helper-maven-plugin</artifactId> 

    <version>1.3</version> 

    <executions> 

     <execution> 

      <id>add-source</id> 

      <phase>generate-sources</phase> 

      <goals> 

       <goal>add-source</goal> 

      </goals> 

      <configuration> 

       <sources> 

        <source>target/metamodel</source> 

       </sources> 

      </configuration> 

     </execution> 

    </executions> 

</plugin> 

を私は主な問題は、そのフォルダどこだと思います生成されたクラスはプロジェクトソースにリンクされていません。このディレクトリがソースフォルダであることをプロジェクトに伝えるか、srcディレクトリの下のすべてを生成する必要があります。

関連する問題