eclipseaspectjajdt

Can't create Run/Debug configuration for AspectJ project in Eclipse


I have a problem, that I can't properly run/debug my AspectJ project in Eclipse. My Launching settings are set to "Execute resource, or if not possible execute project". This is what I want and need, don't advice me to change it please.

My Problem now is that I have a project with 2 files:

If I select Mainclass.java in the project explorer he will ask me how to execute it (same happens if I select the project itself (but in the project he will search for main-Classes)):

Launch project/Mainclass.java

This will result in a new Run/Debug Configuration everytime I launch the project:

enter image description here

If I try to launch from MainclassHook.aj opened I get just a plain error (instead of Eclipse trying to launch the project, just as he does if I select the project and launch it)

enter image description here

Now I think the solution to this would be to add the AspectJ/Java Application into the projects Run/Debug Settings list, but for some reason I can't choose the AspectJ launch there:

Only shows java configurations

How can I achieve that my Eclipse will properly run either my currently selected file, or if it is not launchable, the associated project with a single Run/Debug Configuration which is an AspectJ/Java Application?


Solution

  • I think your wish is a bit sophisticated. If the file is not launchable, why do you want to launch it? Anyway, I know what you mean. It works for Java projects but not 100% for AspectJ projects. If it does not work for your AspectJ files, just select an ancestor folder (e.g. src or project folder) containing a main class instead and the project launch config will be started.

    If you want to raise a bug ticket for this little shortcoming in AJDT (AspectJ Development Tools), you can create it here. Probably it would be best to carefully describe the bug or just link to this question on StackOverflow.