在我的 Java 專案中,我收到指向 Metamodel 類的“ java:找不到符號”錯誤,例如Company_.
所以,首先我檢查my-project\target\generated-sources\annotations并看到它是空的。然后,在網上和SO上進行了幾次搜索之后,我發現必要的設定似乎沒問題,這是我第一次遇到這個問題。
這里是相應的設定pom.xml:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.3.7.Final</version>
</dependency>
而且我已經有了這個設定并且這些沒有被改變:
設定
Settings > Build execution, Deployment > Compiler > Annotation Processors > my-project (selected) :
Enable annotation processing (checked)
從專案類路徑中獲取處理器(選中)
存盤生成的源相對于:模塊內容根
生產源目錄:target\generated-源\annotations
測驗源目錄:target\generated-test-sources\test-annotations
我試圖重建專案、模塊等,但my-project\target\generated-sources\annotations目錄中仍然沒有任何內容。那么,如何在 IntelliJ IDEA 中生成這些JPA Hibernate Metamodel 類?
uj5u.com熱心網友回復:
嘗試從版本中洗掉 .Final 或僅使用其他版本
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/355883.html
