无法使用带有gradle的JavaExec查找或加载主类

时间:2014-01-06 21:33:13

标签: groovy gradle main

我是java Groovy项目机智主类

MainRss.groovy

package com.example.rss.core
public class MainRSS {
    static void main(String args[]) {
        Parser parser = new Parser()
        parser.parseMainRss()
    }
}

buidl.gradle

task parseMainRss(type: JavaExec) {
    description = 'This task will start the main class of the MainRSS'
    group = 'RSSFeed'
    main = 'com.example.rss.core.MainRSS'
    classpath = sourceSets.main.runtimeClasspath

}

执行时

gradle parseMainRss

我有输出:

:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:parseMainRss
Error: Could not find or load main class com.example.rss.core.MainRSS
:parseMainRss FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':parseMainRss'.
> Process 'command 'C:\Program Files\Java\jdk1.7.0_45\bin\java.exe'' finished with non-zero exit value 1

为什么找不到com.example.rss.core.MainRSS它被指定为完全限定名?

0 个答案:

没有答案