Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » inside ant task getProject() returns null
inside ant task getProject() returns null [message #296580] Tue, 27 December 2005 16:03 Go to next message
Mark Russell is currently offline Mark RussellFriend
Messages: 17
Registered: July 2009
Junior Member
this is an ant task that runs under eclipse 3.1. It is a very simple
task that just prints the name of the project.
However when I runt he ant task under headless eclipse I get the message
that getProject returns null.

here is the code:
/**
*
*/
package mrr.test.ant;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

/**
* @author Mark Russell
*
*/
public class PrintProject extends Task
{
private static final String CLASS_NAME = PrintProject.class.getName();

public void execute() throws BuildException {
System.out.println("execute: " + CLASS_NAME);
if (getProject() == null) {
System.err.println("Project is null");
} else {
System.out.println("Project name: " + getProject().getName());
}
}

}

I am also posting this on the ant site
Re: inside ant task getProject() returns null [message #296645 is a reply to message #296580] Thu, 29 December 2005 02:48 Go to previous message
Darin Swanson is currently offline Darin SwansonFriend
Messages: 2386
Registered: July 2009
Senior Member
See bug 34466 comment #7 or see the Eclipse Readme the Platform - Ant
section
or the Eclipse help:
http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/ant_contributing_task.htm
"Important rules..." section

HTH
Darins

"Mark Russell" <fireresq@earthlink.net> wrote in message
news:doroch$lb$1@utils.eclipse.org...
> this is an ant task that runs under eclipse 3.1. It is a very simple task
> that just prints the name of the project.
> However when I runt he ant task under headless eclipse I get the message
> that getProject returns null.
>
> here is the code:
> /**
> *
> */
> package mrr.test.ant;
>
> import org.apache.tools.ant.BuildException;
> import org.apache.tools.ant.Task;
>
> /**
> * @author Mark Russell
> *
> */
> public class PrintProject extends Task
> {
> private static final String CLASS_NAME = PrintProject.class.getName();
>
> public void execute() throws BuildException {
> System.out.println("execute: " + CLASS_NAME);
> if (getProject() == null) {
> System.err.println("Project is null");
> } else {
> System.out.println("Project name: " + getProject().getName());
> }
> }
>
> }
>
> I am also posting this on the ant site
Previous Topic:launching a webpage from a link?
Next Topic:How could I get the content of the current active TextEditor?
Goto Forum:
  


Current Time: Fri Apr 26 04:17:38 GMT 2024

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

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

Back to the top