2017-09-18 43 views
0

我正在嘗試構建官方JOOQ git repo here上給出的示例。行家pom.xml文件包含JOOQ以下插件: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>

但是我不設法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 

任何人都可以幫助我嗎?乾杯。

回答

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,看看是否有助於構建你的春天的例子。

0

我相信代碼gen 3.10.0-SNAPSHOT尚未發佈,以及3.10.0-SNAPSHOT的其餘部分。

如果您需要已開發並使用comforatable已尚未發佈庫的功能,

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

然後運行

mvn install 

要建立jooq 3.10.0 -SNAPSHOT到您的本地存儲庫。該示例應該在您的本地機器上運行。注意它不會在其他地方工作(例如:詹金斯機器)。

如果你覺得不舒服使用此代碼未發行的,使用最新發布的公佈公佈發行版本的例子:

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

由於依賴圖預計3.10.0快照。