I have a Spring Roo (1.2.2) project that I'm trying to build. From a clean SCM checkout, a mvn clean install
builds nicely.
However, when I import the project into my SpringSource Tool Suite IDE (packaged with m2eclipse and Roo 1.2.4), then Eclipse invokes roo
to update the POM's <roo.version>
, which then updates the entity aspects. After this, all of the methods with java.util.Date
paremeters/return types no longer work, as compilation produces symbol not found
errors on the Date
fields.
How do I get Roo to generate aspects with a type of Date
instead of Calendar
?
Error Log
[ERROR] /Users/jjzabkar/project/src/main/java/com/so/FooBar.java:209:0::0 The method setTokenExpires(Calendar) in the type FooBar is not applicable for the arguments (Date)
[ERROR] error at account.setLastaccessTime(Calendar.getInstance().getTime());
Research
- Checked & followed all recommendations in the project's Upgrade to any new Release appendix.
- Haven't been able to find or build (source) Roo version 1.2.2--no
bin\roo
; building from source fails. - Investigated Roo add-ons that add various timestamp fields, but didn't see any mention of them in the project
log.roo
file: spring-roo-addon-audit-timestamp, spring-roo-addon-timestamp, nor were their annotations present on the originally checked out files.
Old POM
<roo.version>1.2.2.RELEASE</roo.version>
Updated POM
<roo.version>1.2.4.RELEASE</roo.version>
FooBar.java
Entity
@RooJavaBean
@RooToString
@RooJpaActiveRecord(versionField = "", table = "foo_bar")
@RooDbManaged(automaticallyDelete = true)
public class FooBar {
}
Aspect BEFORE for Roo Version 1.2.2
privileged aspect FooBar_Roo_DbManaged {
...
@Column(name = "lastaccess_time")
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(style = "M-")
private Date FooBar.lastaccessTime;
public Date FooBar.getLastaccessTime() {
return lastaccessTime;
}
public void FooBar.setLastaccessTime(Date lastaccessTime) {
this.lastaccessTime = lastaccessTime;
}
}
Aspect AFTER for Roo Version 1.2.4
privileged aspect FooBar_Roo_DbManaged {
...
@Column(name = "lastaccess_time")
@NotNull
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(style = "MM")
private Calendar FooBar.lastaccessTime;
public Calendar FooBar.getLastaccessTime() {
return lastaccessTime;
}
public void FooBar.setLastaccessTime(Calendar lastaccessTime) {
this.lastaccessTime = lastaccessTime;
}
}
Before update to Roo 1.2.4 you should push-in Date fields to .java, by doing that Roo won't generate them again and won't change the type to Calendar.