Buildship configuration puts on top of Run (eclipse)

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.

Hi,

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.

Can you reproduce that behavior somehow?

Cheers,
Stefan

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 :slightly_smiling:
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)”

@etiennestuder @donat Do you have any comments about this?

An example project that reproduces these issues (at least occasionally) would really help us diagnose the issues you are seeing.

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”)

Here you have a test project: AAAA - Project.zip (55.8 KB)

Run issue:

Duration issue:

I’ll try to reproduce this behavior, thanks for the 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

For the execution timer issue, I opened Bug 486162

Thank you for pointing us to these issues.

Then that was the change to blame. I don’t know which is the best way to identify a Test class, do all of them use the @Test annotation?

I set the eclipse preference, thanks for the tip!

I’m glad I could help with the other issues.

Unfortunately it’s not that easy, there are many different test frameworks out there. I opened Bug 486170 to track this question.