Java Quartz 2.2.2 缺少方法
Java Quartz 2.2.2 missing method
我正在尝试创建任务计划程序。我用石英。我以 this 为例。
我在 Maven 中建立依赖(测试 2.2.1 和 2.2.2)并且我的 class HelloJob 实现了 Job。
我有
public class HelloJob implements Job{
public void execute(JobExecutionContext context) throws JobExecutionException {
// Say Hello to the World and display the date/time
System.out.println("Hello World! - " + new Date());
JobDetail job = newJob(HelloJob.class)
.withIdentity("job1", "group1")
.build();
}
}
但我收到消息:
The method newJob(Class<HelloJob>) is undefined for the type HelloJob
我试图将 JobDetail 声明放在我的 SimpleExample class 中,但出现了同样的错误...
方法 newJob
在 org.quartz.JobBuilder
中定义为静态方法。在 class:
中添加静态导入
import static org.quartz.JobBuilder.*;
我正在尝试创建任务计划程序。我用石英。我以 this 为例。 我在 Maven 中建立依赖(测试 2.2.1 和 2.2.2)并且我的 class HelloJob 实现了 Job。
我有
public class HelloJob implements Job{
public void execute(JobExecutionContext context) throws JobExecutionException {
// Say Hello to the World and display the date/time
System.out.println("Hello World! - " + new Date());
JobDetail job = newJob(HelloJob.class)
.withIdentity("job1", "group1")
.build();
}
}
但我收到消息:
The method newJob(Class<HelloJob>) is undefined for the type HelloJob
我试图将 JobDetail 声明放在我的 SimpleExample class 中,但出现了同样的错误...
方法 newJob
在 org.quartz.JobBuilder
中定义为静态方法。在 class:
import static org.quartz.JobBuilder.*;