Testing @RooJavaBean class in Eclipse IDE with JUn

2019-08-02 07:50发布

问题:

I use Spring Roo to generate getters/setters. When I update my class under test and then run JUnit tests from Eclipse IDE (STS), it does't see changes I have made. For example:

java.lang.NoSuchMethodError: com.example.web.forms.UserRegistrationForm_Roo_JavaBean.ajc$interMethodDispatch1$com_datefitting_web_forms_UserRegistrationForm_Roo_JavaBean$com_example_web_forms_UserRegistrationForm$setName(Lcom/datefitting/web/forms/UserRegistrationForm;Ljava/lang/String;)V`

After running roo>perform tests everything runs fine even in IDE. In project settings there is AspectJ builder.

How to run JUnit tests of @RooJavaBean annotated class in IDE, without invoking mvn test or roo>perform tests?

回答1:

Is the Roo shell open in STS while you are running? In order for your aspects to be recreated based on changes to the target types, the Roo shell must be running in the IDE. If it is running on the command line (from outside the IDE), STS will not be made aware that changes have been made to aspects and it will not be picked up in your project.