如何使用maven的jooq代码生成器生成代码(How to generate code using jooq code generator with maven)

编程入门 行业动态 更新时间:2024-10-23 04:56:38
如何使用maven的jooq代码生成器生成代码(How to generate code using jooq code generator with maven)

嗨,我试图生成jooq代码文件,但没有成功。 我正在使用intellij和maven来生成代码。 当我尝试生成代码时没有任何反应。 我收到此消息: [INFO] Generating catalogs : Total: 0 。 我正在使用Sql server express与Jooq试用。 这是我的pom:

<?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

以下是我运行生成器工具的方法;

Hi I am trying to generate jooq code files without success. I am using intellij and maven to generate code. When I try an d generate the code nothing happens. I get this message: [INFO] Generating catalogs : Total: 0. I am using Sql server express with Jooq trial. Here is my pom:

<?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>

Here is the output I get when trying to generate the files.

"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

Here is how I am running the generator tool;

最满意答案

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

如果要指定<inputCatalog/>则必须指定<inputCatalog/> 。 目录是数据库的名称。

This is a known issue in jOOQ 3.9.3: https://github.com/jOOQ/jOOQ/issues/6064

You have to specify an <inputCatalog/> if you want to specify an <inputSchema/> as well. The catalog is the name of your database.

更多推荐

本文发布于:2023-04-27 16:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1327164.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   代码   代码生成器   maven   generator

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!