2017-07-30 89 views
1

經過痛苦的安裝春天roo。我正在嘗試創建一個項目。 但是,通過彈簧外殼製作pojo後,我現在創建了彈簧庫。 我跑以下命令創建的POJO無法在春天roo創建存儲庫

entity jpa --class ~.DTO.UserDTO 
field string --fieldName name --notNull --sizeMin 50 

到目前爲止好,但這裏的地方麻煩來:

repository jpa --entity ~.DTO.UserDTO --interface ~.repository.UserDTORepository 

,我馬上就得到這個消息 --entity選項應該是一個實體。 我被卡住了。 我試圖刪除POJO跑tyhe以下命令:

entity jpa --class ~.DTO.UserDTO --testAutomatically --activeRecord false 

消息,我得到的是: "Options 'testAutomatically', 'activeRecord' are not available for this command. Use tab assist or the "help" command to see the legal options 「 ,我試圖 "repository jpa --entity ~.dto.UserRecord --interface ~.repository.UserRepository」 知趣

--entity option should be an entity. 
This is where i gave up 

我的環境是用java 1.8,spring roo 2.0.0.RC1 STS 3.9.0.Release。

回答

2

我已經檢查您的問題,如果你在Spring Roo shell中寫repository jpa --entity之後,你按下自動完成鍵(TABCTRL + Space),你會看到下面的結果顯示:~.dto.UserDTO

所以使用

repository jpa --entity ~.dto.UserDTO --interface ~.repository.UserDTORepository

,而不是

repository jpa --entity ~.DTO.UserDTO --interface ~.repository.UserDTORepository

看得出來,不同的是在~.DTO包的大寫字母。當您輸入實體的名稱時,您使用~.DTO作爲包的名稱,但Spring Roo全部更改爲小寫。原因在於,您可以檢查Oracle Documentation中的軟件包名稱全部寫成小寫,以避免與類或接口的名稱衝突。

請記住,使用TABCTRL + Space構建您將執行的命令來防止這類錯誤非常重要。

希望它有幫助,