Not able to generate Public file using jOOQ auto-code-generator using liquibase schema xml file

164 Views Asked by At

I'm using Liquibase schema xml file to auto-generate code with jOOQ. If I use db connection for generation, then it creates the Public file in generated folder, but with liquibase schema it doesn't.

I want Public file to appear in the generated folder. Right now only these files appear -

enter image description here

I have tried giving in pom.xml as PUBLIC/public/Public but it isn't helping.

Why do I need Public file? - I want to use Table<?> table = PUBLIC.getTable("sometable") to get all the tables present.

Here is the pom.xml configuration:

<plugin>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen-maven</artifactId>
            <version>3.15.5</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>

            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>42.2.12</version>
                </dependency>
            </dependencies>

            <configuration>
                <generator>
                    <database>
                        <name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>

                        <properties>

                            <property>
                                <key>scripts</key>
                                <value>${basedir}/src/main/resources/database.xml</value>
                            </property>

                            <property>
                                <key>includeLiquibaseTables</key>
                                <value>true</value>
                            </property>
                        </properties>
                    </database>

                    <target>
                        <packageName>jooqGenerated</packageName>
                        <directory>target/generated-sources/jooq</directory>
                    </target>
                </generator>
            </configuration>
        </plugin>

Here is the liquibase script:

<?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
               xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
               >
<changeSet author="Divyanshi (generated)" id="1647260645913-14">
    <preConditions onFail="MARK_RAN">
        <not>
            <tableExists tableName="toBeDeleted2" schemaName="public"/>
        </not>
    </preConditions>
    <createTable tableName="toBeDeleted2" schemaName="public">
        <column autoIncrement="true" name="id" type="BIGINT">
            <constraints primaryKey="true" primaryKeyName="toBeDeleted2_pkey"/>
        </column>
        <column name="addedAt" type="numeric"/>
        <column name="endTime" type="numeric"/>
        <column name="startTime" type="numeric"/>
        <column name="intervalCount" type="INT"/>
        <column name="targetTable" type="VARCHAR(100)"/>
        <column name="updatedColumn2" type="numeric"/>
    </createTable>
</changeSet>


<changeSet author="Divyanshi" id="finalUpdate">
    <renameColumn tableName="toBeDeleted2" remarks="finalUpdate update" oldColumnName="updatedColumn2"
                  newColumnName="finalUpdate" schemaName="public"/>
</changeSet>
0

There are 0 best solutions below