" gradle init" (v4.0)生成的build.gradle无法找到包

时间:2017-06-20 18:12:22

标签: java gradle

我使用" gradle init将一个正在运行的Maven项目转换为Gradle。"我得到的包不存在错误。我不确定如何调试此错误。

$ ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :drill-logical:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/home/drill/logical/src/main/java/org/apache/drill/common/expression/LogicalExpression.java:26: error: package org.apache.drill.common.expression.parser does not exist
import org.apache.drill.common.expression.parser.ExprLexer;
                                                ^
/home/drill/logical/src/main/java/org/apache/drill/common/expression/LogicalExpression.java:27: error: package org.apache.drill.common.expression.parser does not exist
import org.apache.drill.common.expression.parser.ExprParser;
                                                ^
/home/drill/logical/src/main/java/org/apache/drill/common/expression/LogicalExpression.java:28: error: package org.apache.drill.common.expression.parser.ExprParser does not exist
import org.apache.drill.common.expression.parser.ExprParser.parse_return;
                                                           ^
/home/drill/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java:29: error: package org.apache.drill.common.expression.parser does not exist
import org.apache.drill.common.expression.parser.ExprLexer;
                                                ^
/home/drill/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java:30: error: package org.apache.drill.common.expression.parser does not exist
import org.apache.drill.common.expression.parser.ExprParser;
                                                ^
/home/drill/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java:31: error: package org.apache.drill.common.expression.parser.ExprParser does not exist
import org.apache.drill.common.expression.parser.ExprParser.parse_return;
                                                           ^

drill / logical目录中的build.gradle:

 $ cat build.gradle

 description = 'Logical Plan, Base expressions'
 dependencies {
     compile project(':drill-protocol')
     compile project(':drill-common')
     compile(group: 'org.apache.calcite', name: 'calcite-core', version:'1.4.0-drill-r21') {
         exclude(module: 'jgrapht-jdk1.5')
         exclude(module: 'commons-logging')
         exclude(module: 'jackson-annotations')
         exclude(module: 'jackson-core')
         exclude(module: 'jackson-databind')
     }

     compile group: 'com.typesafe', name: 'config', version:'1.0.0'
     compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.1'
     compile group: 'org.msgpack', name: 'msgpack', version:'0.6.6'
     compile group: 'org.reflections', name: 'reflections', version:'0.9.8'
     compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.7.1'
     compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.7.1'
     compile group: 'com.codahale.metrics', name: 'metrics-core', version:'3.0.1'
     compile group: 'com.codahale.metrics', name: 'metrics-servlets', version:'3.0.1'
     compile group: 'org.antlr', name: 'antlr-runtime', version:'3.4'
     compile group: 'joda-time', name: 'joda-time', version:'2.9'

     testCompile project(':drill-common')
 }

 task packageTests(type: Jar) {
     from sourceSets.test.output
     classifier = 'tests'
 }

我看错了build.gradle文件吗?最上面的build.gradle列出了与它的pom.xml一对一匹配的依赖关系和存储库。

我应该寻找什么?

1 个答案:

答案 0 :(得分:1)

您缺少的课程由ANTLR生成。您的仓库中有一个ANTLR语法文件,从中生成这些源文件。与Maven构建中使用的大多数插件一样,这不会自动传输到Gradle,但必须手动完成。使用内置的Gradle ANTLR插件生成语法文件中的源。