问题
I am using STS and Java since a while for developing a web application. The project is configured for using Maven, Roo and MySQL as database. I often find that I waste a lot of time in the following cases:
No Roo response - when I modify a domain object Java class even if the Roo shell for the project is open and loaded it would not respond. My current hack to this issue is to generate a new finder for the class using roo (which awakens Roo somehow). Is there any better hack?
Long times to compile - I have set build automatically on as a project option. Perhaps I should not use it. But the bottom line is that sometimes I need to do a small change in a domain object and then run the project hence I need to build the project again and test it (even for small changes). Is there any properties that I can configure to re-compile only some parts of the project?
Maven and Pom - I often found problems with Maven as whenever I was modifying a dependency in
pom.xml
file and saving it whilst forgetting to be on an internal company network the.m2
library would not be updated correctly. In those cases I should have switched to a non internal network before saving thepom.xml
. The annoying bit is that once I then change the network preferences and run the "update all maven dependencies" command, it would not do it properly. The reason is that the pom files for the new library are generated but with an error message as content. What the problem seem to be is that Maven generates these files but then is not clever enough to recognize them and try to fetch again the libraries from the web repositories. To fix this I need to delete the content of the folder and run the command again. Is there anyone that has found a better solution?
Is Roo really worth it? And if so when?
I found that Roo is good to get started and to create the initial database and project configurations (e.g. security). But then? By far I have been using Roo to generate finders but I often find that it takes about 10/15 minutes to Roo to update when a new finder is added to a class (our project is quite big). I am considering starting to keep the Roo shell closed most of the times and manually add the finders in the .aj
files and annotate the .java
file myself. Will this conflict with Roo afterwards (e.g. once I open the Roo shell for some other reason)?
Java and STS
Why does the project take so long to compile? I mean, I imagine that STS is checking that in every single class there is no dependency with the recently modified files and if there is one updates the code and regenerates a jar file. Is this correct? What if I was using PHP or Python? Would the same happen or would be faster? I know there are several discussions on this but as I am listing the issues I am having I thought I would mention this as well. Is the eternal question of which language to use and for what. In our case we have a relational database, huge amount of data, security constraints, and need to do precise computations (strict data typing needed).
回答1:
1. Ensure the Roo is pointing to the correct directory: Preferences, Spring, Roo Support
2. Compile times are often compounded by validation: Preferences, Validation, check Suspend all validators Preferences, Spring, uncheck unwanted validation rules Preferences, General, Build, uncheck build automatically, then manually build when needed
3. Update dependencies by right clicking on the project: Maven, Update Dependencies and Update Project Configuration
Some tips are in the DZone RefCard I wrote. http://refcardz.dzone.com/refcardz/eclipse-tools-spring
Regards, Gordon Dickens
- twitter.com/gdickens
- linkedin.com/in/gordondickens
- Blog: technophile.gordondickens.com
- Free DropBox: http://db.tt/aJQFTac
回答2:
1. No ROO response
I used to have regular trouble with ROO console in STS in earlier versions of ROO. In my experience, ROO shell launched via command-line was more responsive. I guess things have improved in newer versions of STS and ROO. Which version are you using?
2. Long times to compile
Although compile time was good enough for me, the culprit usually were validating builders. Several validating builders that validate XML, JSP, Spring configuration etc too a lot of time to complete. I ended up disabling several validators to bring build time within a reasonable limit.
3. Maven and POM
I experienced similar issues too. Although this isn't exactly a ROO issue, but as ROO doesn't offer an alternative to Maven, this is can be a serious problem for ROO projects. I think there might be an option in M2-Eclipse somewhere that lets you selectively force an update on a dependency.
来源:https://stackoverflow.com/questions/7189127/sts-spring-with-roo-and-maven-too-slow