Springsource tool suite skipping codes

2019-09-01 06:01发布

问题:

I have a very weird problem. When I try to debug a code, sts totally ignores the code. Below is my very simple code and I wondered why the values did not change, when I debugged, the lines from { to client.employmentKindOfWork ="asdasd" are not executed. It skips all and jumped right into client.save().

Client client = Client.FindById(caseInstance.clientIdClient);
if (client!=null) {
  client.clientMailAddr1="sdfsdfsf"
  client.isDelete = true
  client.employmentKindOfWork ="asdasd"
  client.save()
}

I tried the following steps:

  1. cleaning thru wizard command
  2. by clicking project then clean.
  3. Build the project few times.
  4. open and close STS.
  5. Create new workspace then Imported the project again.
  6. Adding this line in preferences?Java>je edit and default vm -XX:+UseParallelGC
  7. Refreshing the project by right click and refresh
  8. recompile thru command wizard

All of which did not work!!!

Pls. suggest anything I haven't tried that might fix this aside from updating because all my team mates have the same version I have and they are not having this prob.

回答1:

You are most likely not running the code that you think you are. Add some system.out.println statements and see if they are being reached. My guess is that they are not. Most likely, you are compiling your class files to one location, but running a stale version of them from another location.

I am assuming that this is a maven project. Make sure that in your java build path (Ctrl-I on the project), that the output folder is set to target/classes and target/test-classes.