无法理解gradle build -Xlint中的错误:未选中

时间:2014-08-27 08:00:49

标签: gradle

使用gradle构建hibernate时出现此错误

:hibernate-entitymanager:compileTestJava
/home/jsiddharth/workspace/hibernate-orm-master/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/criteria/paths/SingularAttributeJoinTest.java:128: error: <anonymous org.hibernate.jpa.test.criteria.paths.SingularAttributeJoinTest$2> is not abstract and does not override abstract method integrate(MetadataImplementor,SessionFactoryImplementor,SessionFactoryServiceRegistry) in Integrator
        return new Integrator() {
                                ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:hibernate-entitymanager:compileTestJava FAILED

FAILURE: Build failed with an exception.

我认为我需要使用-Xlint选项运行gradle,但事实证明,我做错了。我跑

时遇到了这个错误
  

./ gradlew eclipse -Xlint:deprecation -Xlint:未经检查的Maven settings.xml文件不存在:/home/jsiddharth/.m2/settings.xml

FAILURE: Build failed with an exception.

* What went wrong:
Problem configuring task :eclipse from command line. Unknown command-line option '-X'.
> Unknown command-line option '-X'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 16.185 secs

如何运行构建以忽略错误?

1 个答案:

答案 0 :(得分:2)

至于你的问题,-Xlint是一个Java编译器选项,与Gradle无关。您可以通过GRADLE_OPTS指定这些选项,这是Gradle将参数传递给JVM的方式。

具体来说:GRADLE_OPTS="-Xlint:deprecation"

无论如何,这不是你的麻烦。看看错误:

  

SingularAttributeJoinTest $ 2 - ;不是抽象的,并且不会覆盖Integrator中的抽象方法集成(MetadataImplementor,SessionFactoryImplementor,SessionFactoryServiceRegistry)           返回新的Integrator(){

您在SingularAttributeJoinTest中有一个匿名类,它被声明为实现Integrator但未能实现方法integrate并且未被声明为抽象。当然,-Xlint选项无法抑制此类错误。