jOOQ does not generate sources

喜你入骨 提交于 2019-12-04 05:29:34

问题


I am trying to include jOOQ into my code, however no code is being generated.

When executing mvn clean generate-sources, no sources are generated. I want it to create a Category class, which is defined in the following schema.sql-file.

CREATE TABLE IF NOT EXISTS category (
  id INTEGER IDENTITY PRIMARY KEY,
  name VARCHAR(100),
  description VARCHAR(2000),
  age_group VARCHAR(20),
  created DATETIME,
  inserted BIGINT
);

My pom.xml file looks like this:

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

    <artifactId>spring-data-jdbc-jooq</artifactId>

    <parent>
        <groupId>org.springframework.data.examples</groupId>
        <artifactId>spring-data-jdbc-examples</artifactId>
        <version>2.0.0.BUILD-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <name>Spring Data JDBC - Usage with jOOQ</name>
    <description>Sample project demonstrating Spring Data JDBC features</description>

    <dependencies>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq</artifactId>
            <version>3.10.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jooq</artifactId>
            <version>2.0.3.RELEASE</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <version>3.10.8</version>

                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <jdbc>
                        <driver>org.hsqldb.jdbcDriver</driver>
                        <url>jdbc:hsqldb:mem:testdb</url>
                    </jdbc>
                    <generator>
                        <name>org.jooq.util.DefaultGenerator</name>
                        <database>
                            <name>org.jooq.util.hsqldb.HSQLDBDatabase</name>
                            <inputSchema>PUBLIC</inputSchema>
                        </database>
                        <target>
                            <packageName>example.springdata.jdbc.basics.simpleentity.domain</packageName>
                            <directory>${basedir}/gensrc/main/java</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I would assume that a directory gensrc should be created with the appropriate class inside. The maven build runs successfully without any errors.

You can find the whole project in this GitHub repository.


回答1:


You're using an in-memory database: jdbc:hsqldb:mem:testdb. When the jOOQ code generator starts, it receives a new database that is empty, not the database that you may have created elsewhere.



来源:https://stackoverflow.com/questions/51328307/jooq-does-not-generate-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!