gpt4 book ai didi

java - 乔克 : Generate sources with maven in Eclipse is not generating any file

转载 作者:行者123 更新时间:2023-11-30 07:14:26 30 4
gpt4 key购买 nike

我是 JOOQ 和 Maven 的新手。我想通过提供模式来生成 Pojo,如 JOOQ 的文档所述。我尝试使用命令行方式,它运行得很好。我在 Eclipse java 项目中添加了相同的配置。下面是我的 pom.mxl

<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>PojoGenerator</groupId>
<artifactId>PojoGenerator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>rutherford.pojo</name>
<build>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>

<plugins>
<plugin>
<!-- <artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin> -->

<!-- Specify the maven code generator plugin -->
<!-- Use org.jooq for the Open Source edition org.jooq.pro for commercial
editions, org.jooq.pro-java-6 for commercial editions with Java 6 support,
org.jooq.trial for the free trial edition -->
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>3.8.4</version>

<!-- The plugin should hook into the generate goal -->
<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>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1201-jdbc41</version>
</dependency>
</dependencies>

<!-- Specify the plugin configuration. The configuration format is the
same as for the standalone code generator -->
<configuration>

<!-- JDBC connection parameters -->
<jdbc>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/test</url>
<user>postgres</user>
<password>test</password>
</jdbc>

<!-- Generator parameters -->
<generator>
<database>
<name>org.jooq.util.postgres.PostgresDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>public</inputSchema>
</database>
<target>
<packageName>com.generated.pojo</packageName>
<directory>${project.build.directory}/src</directory>

</target>
</generator>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>

我尝试生成资源。它说“BUILD SUCCESS”,但我在任何地方都看不到生成的 Pojo。请让我知道我缺少什么。

最佳答案

您仍然需要将该插件添加到您的构建中,如 <pluginManagement>仅帮助您声明通用配置以供重用。

<build>
<pluginManagement>...</pluginManagement>
<plugins>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<execution>...</execution>
</plugin>
</plugins>
</build>

另请参阅此处的问题:Maven: What is pluginManagement?

在这种情况下,可能更简单的是 ignore this well-known issue in Eclipse and avoid the <pluginManagement> element .

关于java - 乔克 : Generate sources with maven in Eclipse is not generating any file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38687917/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com