Где я могу указать свой класс обратного инжиниринга при использовании плагина hibernate-tools для maven? - PullRequest
0 голосов
/ 03 февраля 2019

У меня есть собственная стратегия, но я не могу понять, как заставить этот плагин использовать его.

Мой соответствующий раздел pom:

<build>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.1.1.RELEASE</version>
        </plugin>

        <plugin>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools-maven-plugin</artifactId>
            <version>5.4.1.Final</version>
            <executions>
                <execution>
                    <id>Display Help</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>help</goal>
                    </goals>
                </execution>
                <execution>
                    <id>Entity generation</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>hbm2java</goal>
                    </goals>
                    <configuration>
                        <templatePath>src/main/resources/templates/</templatePath>
                        <!-- Defaults: -->
                        <outputDirectory>generated-sources/</outputDirectory>
                        <ejb3>false</ejb3>
                        <jdk5>false</jdk5>
                    </configuration>
                </execution>
                <execution>
                    <id>Schema generation</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>hbm2ddl</goal>
                    </goals>
                    <configuration>
                        <!--Possible targetType: SCRIPT (default), STDOUT, DATABASE -->
                        <targetTypes>
                            <param>SCRIPT</param>
                            <param>STDOUT</param>
                            <param>DATABASE</param>
                        </targetTypes>
                        <!-- Defaults: -->
                        <outputDirectory>generated-resources/</outputDirectory>
                        <!--Possible schemaExportAction: CREATE (default), DROP, BOTH -->
                        <schemaExportAction>CREATE</schemaExportAction>
                        <outputFileName>schema.ddl</outputFileName>
                        <delimiter>;</delimiter>
                        <haltOnError>true</haltOnError>
                        <format>true</format>
                    </configuration>
                </execution>
            </executions>
            <configuration>
                <revengFile>src/main/hibernate/hibernate.reveng.xml</revengFile>
                <!-- Defaults: -->
                <packageName></packageName>
                <configFile>src/main/hibernate/hibernate.cfg.xml</configFile>
                <detectManyToMany>true</detectManyToMany>
                <detectOneToOne>true</detectOneToOne>
                <detectOptimisticLock>true</detectOptimisticLock>
                <createCollectionForForeignKey>true</createCollectionForForeignKey>
                <createManyToOneForForeignKey>true</createManyToOneForForeignKey>
            </configuration>
            <dependencies>
                <!-- databases -->
                <dependency>
                    <!-- DB Driver of your choice -->
                    <groupId>com.oracle</groupId>
                    <artifactId>oracle-jdbc8</artifactId>
                    <version>18</version>
                </dependency>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>42.2.1</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>

    <pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                    <version>5.4.1.Final</version>
            </plugin>
            <!--  
            <plugin>
                <groupId>org.springframework.boot</groupId>
            </plugin>
            -->
        </plugins>
    </pluginManagement>

</build>

И мой hibernate.reveng.xml - это:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>

    <type-mapping>
        <sql-type jdbc-type="DATE" hibernate-type="java.time.LocalDate"/>
        <sql-type jdbc-type="TIMESTAMP" hibernate-type="java.time.LocalDateTime"/>
    </type-mapping>

</hibernate-reverse-engineering>

Кроме того, хотя в конфиге я указал использовать "src / main / hibernate / hibernate.cfg.xml", он читает "hibernate.properties"

Я думаю, что у полученного примера https://github.com/stadler/hibernate-tools-maven-plugin неверное имя свойства конфигурации.

Итак:

1) Начальный вопрос

2) Как мнесконфигурировать это, чтобы использовать указанный файл конфигурации?

3) Где находится список всех проблем конфигурации и, наконец, несмотря на наличие

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                    <version>5.4.1.Final</version>
            </plugin>
        </plugins>
    </pluginManagement>

У меня "выполнение плагина, не охватываемое жизненным циклом"в затмении

Так что, очевидно, я не правильно следовал этому ответу StackOverflow Как решить" Выполнение плагина, не охватываемое конфигурацией жизненного цикла "для Spring Data Maven Builds

...