2016-12-21 5 views
1

JOOQを初めてお使いで、クラスの生成に問題があります。私はそれがデータベースに接続し、設定どおりjooqフォルダの下のクラスの束を生成-PのMySQLをインストールし、クリーンMVN実行すると は私がSpring JOOQの生成が部分的に失敗する

<?xml version="1.0" encoding="UTF-8"?> 
<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.knodeit</groupId> 
    <artifactId>try</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>try</name> 
    <description>Demo project for Spring Boot</description> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.4.2.RELEASE</version> 
     <relativePath/> <!-- lookup parent from repository --> 
    </parent> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <java.version>1.8</java.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.jooq</groupId> 
      <artifactId>jooq</artifactId> 
      <version>3.7.4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jooq</groupId> 
      <artifactId>jooq-meta</artifactId> 
      <version>3.7.4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jooq</groupId> 
      <artifactId>jooq-codegen</artifactId> 
      <version>3.7.4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 

    <profiles> 

     <profile> 
      <id>mysql</id> 
      <build> 
       <plugins> 
        <plugin> 

         <groupId>org.jooq</groupId> 
         <artifactId>jooq-codegen-maven</artifactId> 
         <executions> 
          <execution> 
           <goals> 
            <goal>generate</goal> 
           </goals> 
          </execution> 
         </executions> 
         <dependencies> 
          <dependency> 
           <groupId>mysql</groupId> 
           <artifactId>mysql-connector-java</artifactId> 
           <version>${mysql.version}</version> 
          </dependency> 
         </dependencies> 
         <configuration> 
          <jdbc> 
           <driver>com.mysql.jdbc.Driver</driver> 
           <url>jdbc:mysql://localhost:3306</url> 
           <user>root</user> 
           <password>root</password> 

          </jdbc> 
          <generator> 
           <name>org.jooq.util.JavaGenerator</name> 
           <database> 
            <name>org.jooq.util.mysql.MySQLDatabase</name> 
            <includes>.*</includes> 
            <excludes /> 
            <inputSchema>demo</inputSchema> 
           </database> 
           <generate> 
            <relations>true</relations> 
            <deprecated>false</deprecated> 
            <instanceFields>true</instanceFields> 
            <generatedAnnotation>true</generatedAnnotation> 
            <records>true</records> 
            <pojos>true</pojos> 
            <immutablePojos>false</immutablePojos> 
            <interfaces>true</interfaces> 
            <daos>true</daos> 
            <jpaAnnotations>true</jpaAnnotations> 
            <validationAnnotations>true</validationAnnotations> 
            <springAnnotations>true</springAnnotations> 
            <globalObjectReferences>true</globalObjectReferences> 
            <fluentSetters>false</fluentSetters> 
           </generate> 
           <target> 
            <packageName>com.knodeit.jooq.domain</packageName> 
            <directory>jooq</directory> 
           </target> 
          </generator> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 


</project> 

次Spring構成のpom.xmlを持っています。 はしかし、その後私のようなエラーのトンを参照してください。

[ERROR] /Users/petervandeput/Documents/Development/test/try/jooq/com/knodeit/jooq/domain/tables/records/BookRecord.java:[76,25] cannot find symbol 
[ERROR] symbol: method get(int) 
[ERROR] location: class com.knodeit.jooq.domain.tables.records.BookRecord 
[ERROR] /Users/petervandeput/Documents/Development/test/try/jooq/com/knodeit/jooq/domain/tables/records/BookRecord.java:[210,9] cannot find symbol 
[ERROR] symbol: method set(int,java.lang.Integer) 
[ERROR] location: class com.knodeit.jooq.domain.tables.records.BookRecord 
[ERROR] /Users/petervandeput/Documents/Development/test/try/jooq/com/knodeit/jooq/domain/tables/records/BookRecord.java:[211,9] cannot find symbol 
[ERROR] symbol: method set(int,java.lang.String) 

は、誰かがそれが必要としてMySQL上のスキーマに接続し、生成し、100%の作業のpom.xmlを提供することはできますか?

答えて

0

あなたの生成コードはjOOQ 3.8をターゲットにしています(例えば、Record.get(int)メソッドがある場合)。

あなたの依存関係では、まだこの方法がないjOOQ 3.7を参照しています。

あなたのjOOQコードジェネレータのバージョンとあなたのjOOQランタイムのバージョンが一致している必要があります。これには2つのソリューションがあります。

  1. はあなたの依存関係からバージョン3.7.4への参照を削除し、そして春ブーツから参照バージョンを使用し、代わりに
  2. 明示的にあなたのコード生成バージョンとしても、バージョン3.7.4を設定します(現在省略しています)
関連する問題