Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Validator2 won't run on build?(Why won't my validator run on build.)
Validator2 won't run on build? [message #976187] Thu, 08 November 2012 11:34 Go to next message
William Bath is currently offline William BathFriend
Messages: 3
Registered: July 2009
Junior Member
Hi All,
I'm new to the validation framework and I am building a custom validator for some Javascript that is hosted on a remote server. I can get it to validate manually; but nothing happens on a build.

I used the validator extension point:
         name="OPS Validator"
               label="OPS Errors"

and implemented it:
public class OPSValidator extends AbstractValidator {
	public OPSValidator() {
		System.err.println("OPSVAl is here!");

	public ValidationResult validate(IResource resource, int kind,
			ValidationState state, IProgressMonitor monitor) {
		System.err.println("OPSVAl validating: "+resource.getName());
		List<ScriptValidationProblem> probs = getValidationProblems(resource);
		ValidationResult vr = new ValidationResult();
		for (ScriptValidationProblem p : probs){
			ValidatorMessage message = ValidatorMessage.create(p.getMessage(), resource);
			message.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
			message.setAttribute(IMarker.LINE_NUMBER, p.getLineNumber());
		return vr;

	public ValidationResult validate(ValidationEvent event,
			ValidationState state, IProgressMonitor monitor) {
		return validate(event.getResource(), event.getKind(), state, monitor);

	private List<ScriptValidationProblem> getValidationProblems(IResource resource){
		try {
			if (resource.getLocationURI().getScheme().equals(OpsCmsFileSystem.OPS_SCHEME)){
				OpsCmsFileStore store = (OpsCmsFileStore)EFS.getStore(resource.getLocationURI());
				return store.getValidationProblems();
		} catch (CoreException e) {
			// TODO Auto-generated catch block
		return Collections.EMPTY_LIST;

and it all works for manual validation (i.e. if I right click and select validate in the context menu; but nothing happens off a build (I've tried automatic building; cleaning and building manually; nothing happens).

I've checked the preferences to ensure my validator shows up and has the manual and build options checked; all good.

So what else do I need to do to get my validator to validate my resources on build?

Do I need specific natures; do I need a specific builder in my .project file? For completeness; here is my .project file:
<?xml version="1.0" encoding="UTF-8"?>

Any and all help much appreciated!

[Updated on: Thu, 08 November 2012 11:36]

Report message to a moderator

Re: Validator2 won't run on build? [message #976457 is a reply to message #976187] Thu, 08 November 2012 15:45 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3178
Registered: July 2009
Senior Member

Looks like the Validation Builder itself is not set on the project. The project's Validation property page can do that for you. It should add this to your .project file, before the natures tag:


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Validator2 won't run on build? [message #976828 is a reply to message #976457] Thu, 08 November 2012 22:03 Go to previous message
William Bath is currently offline William BathFriend
Messages: 3
Registered: July 2009
Junior Member
Bang on Nitin; as soon as I put it in my .project validation came to life! Thanks!
Previous Topic:Failed while installing Axis2 Web Services Core 1.1
Next Topic:Adding JavaScript Library to a JavaScriptProject programatically
Goto Forum:

Current Time: Sun Jun 24 00:00:40 GMT 2018

Powered by FUDForum. Page generated in 0.02018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top