I am trying to write a java custom task within an existing project.
package oracle.anttasks.test;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.TaskAction;
public class GreetingTask {
@TaskAction
public void greet() {
System.out.println ("hello from GreetingTask in another project");
}
}
I have added the gradle core jar in the classpath as I was initially getting an error for the import statement.
The code doesnt show any error but when i try to compile the project. I get an error:
[javac] D:\GitRepo\fabuildtasks\main\java\oracle\anttasks\test\GreetingTask.java:3: package org.gradle.api does not exist
[javac] import org.gradle.api.DefaultTask;
[javac] ^
[javac] D:\GitRepo\fabuildtasks\main\java\oracle\anttasks\test\GreetingTask.java:4: package org.gradle.api.tasks does not exist
[javac] import org.gradle.api.tasks.TaskAction;
Can someone please help me get resolve this?
Thanks!