Need to run “maven package” to update unit tests

2019-08-06 19:41发布

问题:

I recently "enabled dependency management" in maven2 for a web project which I had a simple test class running in.

Before I added the maven2 management, whenever I updated the test - the change would appear instantaneous.

However, now I have to run "mvn clean package" before the slightest change can be picked up.

I can see "Maven Builder: AUTO_BUILD" run whenever I save a class but the update just isn't picked up until I run the mvn goal.

I also can't seem to configure a "Maven Builder" when I right click on the project and go to Properties > Builders.

Any help on this would be much appreciated.

Thanks, Gearoid.

回答1:

Strange one - I right clicked on my project and went Properties > Maven > LifeCycle Mapping.

I added "package" to the mapping and everything started working correctly.

Interestingly, I went back and removed "package" and everything worked as normal.