java: cannot find symbol: class TaskListener
Answered
I have ProjectComponent class:
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.tasks.TaskListener;
import org.jetbrains.annotations.NotNull;
public class TaskTimerComponent implements ProjectComponent, TaskListener {
@Override
public void projectOpened() {
}
@Override
public void projectClosed() {
}
@Override
public void initComponent() {
}
@Override
public void disposeComponent() {
}
@NotNull
@Override
public String getComponentName() {
return "Task Timer";
}
}
Why TaskListener class isn't available in my plugin?
Please sign in to leave a comment.
Make sure it's in the module dependencies (http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html): IDEA\plugins\tasks\lib\tasks-api.jar\com\intellij\tasks\TaskListener.class.
Plugins are not added to SDK or dependencies by default.
The above link is broken. This is the current link: https://www.jetbrains.com/help/idea/2016.2/configuring-module-dependencies-and-libraries.html
So in order to access`TaskListener` you need to add `tasks-api.jar` as a Dependency to your Plugin module. You will find this jar in something like the below location (I am using a Windows system):
C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2\plugins\tasks\lib
Also you need to mention this dependency in the plugin.xml file.