2

I'm working in eclipse and I would like to set up a project builder for project A (a plugin-in project) so that whenever a resource in project A is modified, a Java application is launched. The Java application in question exists in my workspace as project B (a Java project) and I have a Java launch configuration for it.

When I go to Properties > Builders in project A and I try to either create a new builder or import an existing one, the only options are:

  • Ant task
  • External tool

I could package project B and all its dependencies in a runnable JAR and launch it via an ant task, but this seems like overkill when I actually have the B's launch configuration available right there, in the workspace. Is there any way to use B's launch configuration in the project builder? If not, what is the best alternative? My google skills are failing me in finding this out.

Thanks

1
  • I think the only other option is to write an incremental builder plugin using the org.eclipse.core.resources.builders extension point. Commented Jan 22, 2016 at 14:27

2 Answers 2

2

You can choose "External Program" and enter these values in tab main:

  • Location: path to java binary
  • working directory: your project A location (or whatever you expect when you run B)
  • Arguments: classpath, main class of B and additional arguments (i.e. all the values of your existing launch config).

This still copies the launch config but at least you don't need to create an ant build file.

Sign up to request clarification or add additional context in comments.

3 Comments

It works great, thanks so much. I hadn't attempted this because I though I would have to explicitly provide B's entire classpath but now I see that there is a variable that does exactly this (${project_classpath:B}) so actually this solution is perfect for my purposes :)
@Alix forgot to mention: The refresh tab in the builder tabs allows you to specify which resources to refresh after the builder has run. So if your programm B changes things the changes are immediately reflected in ecplise. This is a handy feature not available for normal launch configs.
I had actually run into this and set it up to update the resources modified by B, but it's a great tip in any case, thanks :)
0

To complete wero answer, as I struggle a bit to find the right parameters, here what it could look like:

eclipse builder screenshot

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.