I keep Buildship updated and since some months ago while I’m testing/running my app sometimes the Run button executes a Gradle configuration. I must say, I used the plugin with Eclipse for months and this wasn’t happening before, this started some time ago.
It’s really annoying because it’s unpredictable. For example, I press Run to execute my app, close it, and the next Run, out of the blue, starts building my entire project.
I couldn’t find a way to stop this, but I know it was not happening on previous versions of Buildship.
The “Run” button in Eclipse reruns the last launch configuration that was started. If the last thing you started was a Gradle build, then that build will be relaunched.
If Buildship replaces the last run configuration even though you did not run a build, that would be a bug.
Then it’s definitely a bug, in Buildship or Eclipse.
I just found another example. I have the file that I run open in the Editor, press Run, and runs the app. Open another file from the same project, press Run, and the Gradle task starts running.
It’s driving me crazy. I have the latest eclipse: Version: Mars.1 Release (4.5.1) - Build id: 20150924-1200
Another Bug: I just pressed the Stop red button from the Gradle Executions tab (the tooltip says “Cancel the execution”). The task stopped but not the Duration.
Right now is 554,023 s
More specificaly, Run build -> Run tasks -> :compileJava is the one that is still adding seconds to the Duration column.
Edit: Also, the Progress tab has one entry with a Zzz icon that says “Updating duration of non-finished operations (Sleeping)”
I found another Bug.
I’m doing a test project for you, and I close all my other projects. However, in the “Run Configurations” I still see the Gradle Tasks from the closed projects. “Java Application” tasks are hidden when a project is closed. (Right-click on the project -> “Close Project”)
I opened Bug 486161 for the launch configurations for closed projects.
The launch behavior you are seeing (Buildship launching a test when you switch to Other.java) is expected and has the following reasons:
you have activated “context sensitive launching” in the preferences, so Eclipse tries to launch the class that is open in the current editor
Buildship adds the “Run as Gradle test” launch configuration to any Java class. We cannot know all the different test frameworks that people might use, so we decided to always add this action
It seems what you expect is to launch the last launch configuration instead. You can change that in the preferences: Run/Debug > Launching > Launch Operation > Always launch the previously launched application