2017-07-04 153 views
0

嗨我想生成jooq代码文件没有成功。我使用intellij和maven来生成代码。当我尝试生成代码时,什么都不会发生。我收到此消息:[INFO] Generating catalogs : Total: 0。我正在使用Jooq试用版的Sql server express。这是我的pom:如何使用jooq代码生成器与maven生成代码

<?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.test</groupId> 
    <artifactId>service</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

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

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.5.4.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>com.groupid</groupId> 
      <artifactId>entities</artifactId> 
      <version>1.0.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-jdbc</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web-services</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.microsoft.sqlserver</groupId> 
      <artifactId>mssql-jdbc</artifactId> 
      <version>6.1.0.jre8</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jooq.trial</groupId> 
      <artifactId>jooq</artifactId> 
      <version>3.9.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jooq.trial</groupId> 
      <artifactId>jooq-meta</artifactId> 
      <version>3.9.3</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jooq.trial</groupId> 
      <artifactId>jooq-codegen</artifactId> 
      <version>3.9.3</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <groupId>org.jooq.trial</groupId> 
       <artifactId>jooq-codegen-maven</artifactId> 
       <version>3.9.3</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>generate</goal> 
         </goals> 
        </execution> 
       </executions> 

       <!-- Manage the plugin's dependency. In this example, we'll use a PostgreSQL database --> 
       <dependencies> 
        <dependency> 
         <groupId>com.microsoft.sqlserver</groupId> 
         <artifactId>mssql-jdbc</artifactId> 
         <version>6.1.0.jre8</version> 
        </dependency> 
       </dependencies> 

       <!-- Specify the plugin configuration. 
        The configuration format is the same as for the standalone code generator --> 
       <configuration> 
        <!--<logging>WARN</logging>--> 
        <!-- JDBC connection parameters --> 
        <jdbc> 
         <driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver> 
         <url>jdbc:sqlserver://localhost;databaseName=test</url> 
         <user>sa</user> 
         <password>test</password> 
        </jdbc> 

        <!-- Generator parameters --> 
        <generator> 
         <database> 
          <includes>.*</includes> 
          <excludes></excludes> 
          <!--<inputCatalog>public</inputCatalog>--> 
          <inputSchema>dbo</inputSchema> 
         </database> 
         <target> 
          <packageName>mypackage</packageName> 
          <directory>mypath</directory> 
         </target> 
        </generator> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

这是我在试图生成文件时得到的输出。

"C:\Program Files\Java\jdk1.8.0_131\bin\java" -Dmaven.multiModuleProjectDirectory=C:\projects\service "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\lib\idea_rt.jar=59337:C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.1.4 jooq-codegen:generate 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building service 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- jooq-codegen-maven:3.9.3:generate (default-cli) @ service --- 
[INFO] Database     : Inferring database org.jooq.util.sqlserver.SQLServerDatabase from URL jdbc:sqlserver://localhost:1433;authentication=NotSpecified;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustServerCertificate=false;TransparentNetworkIPResolution=true;serverNameAsACE=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=test;columnEncryptionSetting=Disabled;applicationName=Microsoft JDBC Driver for SQL Server;applicationIntent=readwrite; 
[INFO] No <inputCatalog/> was provided. Generating ALL available catalogs instead. 
[INFO] License parameters  
[INFO] ---------------------------------------------------------- 
[INFO] Thank you for using jOOQ and jOOQ's code generator 
[INFO]       
[INFO] Database parameters  
[INFO] ---------------------------------------------------------- 
[INFO] dialect    : SQLSERVER 
[INFO] URL     : jdbc:sqlserver://localhost:1433;authentication=NotSpecified;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustServerCertificate=false;TransparentNetworkIPResolution=true;serverNameAsACE=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=test;columnEncryptionSetting=Disabled;applicationName=Microsoft JDBC Driver for SQL Server;applicationIntent=readwrite; 
[INFO] target dir    : [target dir] 
[INFO] target package   : com.test 
[INFO] includes    : [.*] 
[INFO] excludes    : [] 
[INFO] includeExcludeColumns : false 
[INFO] ---------------------------------------------------------- 
[INFO]       
[INFO] JavaGenerator parameters 
[INFO] ---------------------------------------------------------- 
[INFO] strategy    : class org.jooq.util.DefaultGeneratorStrategy 
[INFO] deprecated    : true 
[INFO] generated annotation : true 
[INFO] JPA annotations  : false 
[INFO] validation annotations : false 
[INFO] instance fields  : true 
[INFO] sequences    : true 
[INFO] udts     : true 
[INFO] routines    : true 
[INFO] tables     : true 
[INFO] records    : true 
[INFO] pojos     : false 
[INFO] immutable pojos  : false 
[INFO] interfaces    : false 
[INFO] immutable interfaces : false 
[INFO] daos     : false 
[INFO] relations    : true 
[INFO] table-valued functions : true 
[INFO] global references  : true 
[INFO] ---------------------------------------------------------- 
[INFO]       
[INFO] Generation remarks  
[INFO] ---------------------------------------------------------- 
[INFO]       
[INFO] ---------------------------------------------------------- 
[INFO] 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@@@@@@@@@@@@@@@@ @@  @@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@  @@@@@@@@@@ 
@@@@@@@@@@@@@@@@ @@ @@ @@@@@@@@@@ 
@@@@@@@@@@ @@@@ @@ @@ @@@@@@@@@@ 
@@@@@@@@@@  @@  @@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@@@@@@@@@@  @@  @@@@@@@@@@ 
@@@@@@@@@@ @@ @@ @@@@ @@@@@@@@@@ 
@@@@@@@@@@ @@ @@ @@@@ @@@@@@@@@@ 
@@@@@@@@@@  @@ @ @ @@@@@@@@@@ 
@@@@@@@@@@  @@  @@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Thank you for using the 30 day free jOOQ 3.9.3 trial edition 

[INFO] Generating catalogs  : Total: 0 
[INFO] Removing excess files  
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.214 s 
[INFO] Finished at: 2017-07-04T18:10:46-05:00 
[INFO] Final Memory: 23M/217M 
[INFO] ------------------------------------------------------------------------ 

Process finished with exit code 0 

这是我如何运行生成器工具;

enter image description here

回答

1

这是jOOQ 3.9.3的已知问题:https://github.com/jOOQ/jOOQ/issues/6064

,如果你想指定<inputSchema/>以及您必须指定一个<inputCatalog/>。该目录是您的数据库的名称。

+0

真棒,这为我工作。 – Luke101