简体   繁体   中英

jOOQ disable DAO and POJO generation

My project requires me to generate DAOs and POJOs on my own. Have to do certain modifications to it. My SRS says that I have to use jOOQ. I am using it for the first time; I understand that jOOQ generates POJOs and DAOs on its own, but I couldn't find a way to disable it.

I could't find anything in jOOQ's documentation that would help me with this. Could someone tell me how to disable jOOQ from generation DAO and POJO but still provide the Records.

The Maven pom.xml file is as follows:

<?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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>org.jooq</groupId>
    <artifactId>jooq-parent</artifactId>
    <version>3.4.1</version>
</parent>

<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<name>jOOQ</name>

<licenses>
    <license>
        <name>Apache License, Version 2.0</name>
        <url>http://www.jooq.org/inc/LICENSE.txt</url>
        <distribution>repo</distribution>
    </license>
    <!-- [pro] xxx
    xxxxxxxxx
        xxxxxxxxxx xxxxxxx xxx xxxxxxxxxxx xxxxxxxxxxxxxxxx
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxx
    xxxx [/pro] -->
</licenses>

<build>
    <plugins>
        <!-- XJC-generate JAXB artefacts. Contribution is the courtesy
             of Sergey Epik -->
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.8.1</version>
            <executions>
                <!-- If this causes trouble in your Eclipse m2e lifecycle configuration, try using
                     http://m2eclipse.sonatype.org/sites/m2e/, instead of the official m2e Eclipse
                     plugin
                  -->
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <extension>true</extension>
                <strict>false</strict>
                <schemaDirectory>src/main/resources/xsd</schemaDirectory>
                <bindingDirectory>src/main/resources/xjb</bindingDirectory>
                <schemaIncludes>
                    <include>jooq-runtime-3.3.0.xsd</include>
                </schemaIncludes>
                <generatePackage>org.jooq.conf</generatePackage>
                <args>
                    <arg>-Xxew</arg>
                    <arg>-Xxew:instantiate lazy</arg>
                    <arg>-Xxew:delete</arg>
                    <arg>-Xfluent-api</arg>
                    <arg>-Xdefault-value</arg>
                    <arg>-Xannotate</arg>
                    <arg>-Xinheritance</arg>
                </args>
                <plugins>
                    <plugin>
                        <groupId>com.github.jaxb-xew-plugin</groupId>
                        <artifactId>jaxb-xew-plugin</artifactId>
                        <version>1.0</version>
                   </plugin>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-fluent-api</artifactId>
                        <version>3.0</version>
                    </plugin>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-default-value</artifactId>
                        <version>1.1</version>
                    </plugin>
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics-annotate</artifactId>
                        <version>0.6.2</version>
                    </plugin>              
                    <plugin>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>0.5.3</version>
                    </plugin>      
                </plugins>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.1.0</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>bundle-manifest</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>manifest</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <supportedProjectTypes>
                    <supportedProjectType>jar</supportedProjectType>
                </supportedProjectTypes>
                <instructions>
                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                    <Export-Package>*</Export-Package>
                    <Import-Package>
                        javax.persistence;resolution:=optional,
                        org.apache.log4j;resolution:=optional,
                        *
                    </Import-Package>
                    <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
                </instructions>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <archive>
                    <!-- add the generated manifest to the jar -->
                    <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <id>release</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

<dependencies>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <type>jar</type>
        <scope>provided</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>integration</artifactId>
        <version>1.6.1</version>
        <type>jar</type>
        <scope>provided</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>persistence-api</artifactId>
        <version>1.0</version>
        <type>jar</type>
        <scope>provided</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.1.0.Alpha1</version>
        <type>jar</type>
        <scope>provided</scope>
        <optional>true</optional>
    </dependency>


    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jmock</groupId>
        <artifactId>jmock-junit4</artifactId>
        <version>2.6.0</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.1</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.7</version>
        <type>jar</type>
        <scope>test</scope>
    </dependency>
</dependencies>

And the build is using gradle . I dont know how will that affect the changes either.

the project is built using gradle . so config for all dependencies are redirected to build.gradle . the extract from the build file that helped me mutate jooq properties are:

    jooq 
    { 
      generator 
        { generate 
           { relations = true 
             deprecated = false 
             records = true 
             immutablePojos = false 
             daos = false 
             fluentSetters = true 
       } 
      target { packageName = '...' } 

that file isnt accessible from the project directory but i could edit it here!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM