Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ajdt-dev] Finding build errors in IProject programatically

Hi,

I'd like to write unit tests that will build some predefined
AspectJ projects and test if there are no errors. I used
org.eclipse.ajdt.core.tests and AJDTCoreTestCase as an example.

I load and build projects using
AJDTCoreTestCase.createPredefinedProject(...) method. It works but I
can't get information about problems (e.g. syntax errors). I tried
standard JDT way - using IMarker and findMarkes method:

IProject project = createPredefinedProject("AspectJProject");

System.out.println("Errors:");
IMarker[] errors = project.findMarkers(null /*all markers*/, true,
                IResource.DEPTH_INFINITE);
for (IMarker error : errors) {
        System.out.println(error.getAttribute(IMarker.MESSAGE));
}

I tested it on simple project with syntax error. When project is
AspectJ Project no error appears. But after removing AspectJ
capability the proper error (marker) is returned from findMarkers
method.

Inspecting code I found out that only classpath errors are notified
using markers in AspectJ projects.

My question: is there any way to get a list of compilation problems
having only IProject element?

Best regards,
 David Pytel



Back to the top