Maven pom.xml文件中的JOOQ插件

时间:2017-09-18 01:50:15

标签: spring maven jooq

我试图建立官方JOOQ git repo here上给出的例子。 maven pom.xml文件包含以下JOOQ插件:



<plugin>
    <groupId>org.jooq</groupId>
    <artifactId>jooq-codegen-maven</artifactId>
    <version>${org.jooq.version}</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <jdbc>
                    <driver>${db.driver}</driver>
                    <url>${db.url}</url>
                    <user>${db.username}</user>
                    <password>${db.password}</password>
                </jdbc>
                <generator>
                    <target>
                        <packageName>com.learnd.jooq.db</packageName>
                        <directory>src/main/java</directory>
                    </target>
                </generator>
            </configuration>
        </execution>
    </executions>
</plugin>
&#13;
&#13;
&#13;

但是,由于mvn compile标记中的${org.jooq.version}变量,我未能管理<version>项目,并且我得到了以下输出。但每当我看到插入此插件时,我就已经看到它以这种方式完成,即使是here

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.jooq:jooq-spring-example:jar:3.10.0-SNAPSHOT
[WARNING] 'version' contains an expression but should be a constant. @ org.jooq:jooq-spring-example:${org.jooq.version}, /home/lukec/Desktop/jOOQ-spring-example/pom.xml, line 8, column 14
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building jOOQ Spring Example 3.10.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.jooq:jooq-codegen-maven:jar:3.10.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.213 s
[INFO] Finished at: 2017-09-18T03:47:16+02:00
[INFO] Final Memory: 6M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.jooq:jooq-codegen-maven:3.10.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.jooq:jooq-codegen-maven:jar:3.10.0-SNAPSHOT -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

任何人都可以帮我吗?欢呼声。

3 个答案:

答案 0 :(得分:2)

最可能的原因是Maven无法在您当地的.m2中找到jOOQ-codegen-maven 3.10.0-SNAPSHOT版本。我检查了你的问题中的链接,我在这个链接https://github.com/jOOQ/jOOQ/blob/master/jOOQ-codegen-maven/pom.xml中看到了spring项目及其依赖项目jOOQ-codegen-maven,因此请导入并构建它,以便此版本进入您的本地.m2。我看到jOOQ-codegen-maven项目有一个父jooq-parent,所以你可能需要构建它以便依赖关系得到解决。

成功构建并运行jOOQ-codegen-maven和jooq-parent之后,本地.m2应该具有这些依赖关系,再次尝试构建jooq-spring-example,现在应该正确解析3.10.0-SNAPSHOT依赖关系

以上内容最有可能解决问题但如果它不起作用,您可以尝试使用中央版本https://mvnrepository.com/artifact/org.jooq/jooq-codegen-maven/3.9.5,看看是否有助于构建您的Spring示例。

答案 1 :(得分:0)

没有正式发布的3.10.x jooq-codegen-maven插件。

{{3}}

您应该尝试使用上面链接中找到的任何一个。

答案 2 :(得分:0)

我相信代码gen 3.10.0-SNAPSHOT还没有和3.10.0-SNAPSHOT的其余部分一起发布。

如果您需要已经开发的功能并且可以使用尚未发布的库进行操作,

git clone https://github.com/jOOQ/jOOQ

然后运行

mvn install

将jooq 3.10.0-SNAPSHOT构建到本地存储库。该示例应在您的本地计算机上运行。请注意,它不会在其他地方工作(EX:jenkins机器)。

如果您对使用此未发布的代码感到不舒服,请使用最新发布的已发布发布版本的示例:

https://github.com/jOOQ/jOOQ/tree/version-3.9.0-branch/jOOQ-examples/jOOQ-spring-example

由于依赖图需要3.10.0-SNAPSHOT。