0

我正在与 Spring-Roo 合作。

是否可以从依赖包中添加字段引用?我在脚本的请求中添加了依赖项,

dependency add --groupId com.testroo.platform --artifactId platform --version 0.1.0.BUILD-SNAPSHOT

然后我在添加 jpa 实体时执行此操作

field reference --fieldName city --type ~.domain.City --notNull

但它抱怨以下。

The specified target '--type' does not exist or can not be found. Please create
this type first. 

我认为 spring-roo 足够聪明,可以从依赖中解决它。我在这里错过了什么吗?干杯。

4

1 回答 1

1

使用 Spring roo 并创建一个新项目时,您首先声明一个顶级包名称(假设输入 com.foo)。~符号用于稍后引用此包名称。

因此,在您的情况下,如果您将 ~.domain.City 作为类型参数的参数,roo 将在 com.foo.domain.City 中查找它,因为 ~ 符号替换了顶级包。

简短回答:如果要从依赖包中添加字段引用,请给出类的全名。

于 2012-09-06T20:10:39.177 回答