NPE during the build (Gradle 1.6 release)


(Alex Sko) #1

$ gradle build --stacktrace

FAILURE: Build failed with an exception.

  • Where: Build file ‘C:\projects\taskadapter\webshared\build.gradle’ line: 3

  • What went wrong: A problem occurred evaluating project ‘:webshared’. > java.lang.NullPointerException (no error message)

  • Try: Run with --info or --debug option to get more log output.

  • Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating project ‘:webshared’.

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)

at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)

at org.gradle.configuration.BuildScriptProcessor.execute(BuildScriptProcessor.java:36)

at org.gradle.configuration.BuildScriptProcessor.execute(BuildScriptProcessor.java:23)

at org.gradle.configuration.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)

at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)

at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:465)

at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:76)

at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)

at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)

at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)

at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:39)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:26) Caused by: java.lang.NullPointerException

at org.gradle.util.GUtil.flatten(GUtil.java:69)

at org.gradle.util.GUtil.collectionize(GUtil.java:93)

at org.gradle.util.GUtil$collectionize.call(Unknown Source)

at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.methodMissing(DefaultDependencyHandler.groovy:98)

at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.invokeMethod(DefaultDependencyHandler.groovy)

at build_s6otjn10bn7fgl88koh2p07hp$_run_closure1.doCall(C:\projects\taskadapter\webshared\build.gradle:3)

at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)

at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:133)

at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:94)

at org.gradle.api.internal.project.AbstractProject.dependencies(AbstractProject.java:872)

at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)

at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:83)

at build_s6otjn10bn7fgl88koh2p07hp.run(C:\projects\taskadapter\webshared\build.gradle:1)

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)

… 30 more

here’s my webshared/build.gradle file:

dependencies {
    compile libraries.httpclient
    compile libraries.httpcore
    compile libraries.slf4j
    compile libraries.slf4jJdk
      compile 'com.vaadin:vaadin-server:7.0.5'
    compile 'com.vaadin:vaadin-client-compiled:7.0.5'
      compile project(":common")
    compile project(":mainapp")
    compile project(":license")
      testCompile project(":test-utilities")

and the root build.gradle:

ext.libraries = [
    gson: 'com.google.code.gson:gson:1.6',
    httpclient: 'org.apache.httpcomponents:httpclient:4.2',
    httpclient: 'org.apache.httpcomponents:httpcore:4.2',
    slf4j: 'org.slf4j:slf4j-api:1.6.6',
    slf4jJdk: 'org.slf4j:slf4j-jdk14:1.6.6'
  ]
  subprojects {
      apply plugin: 'java'
      sourceCompatibility = 1.6
    targetCompatibility = 1.6
      repositories {
        mavenCentral()
    }
      dependencies {
        compile 'com.google.guava:guava:12.0'
        testCompile 'junit:junit:4.11'
    }
}

(Peter Niederwieser) #2

It’s a copy/paste error in your ‘ext.libraries’. You declare ‘httpclient’ a second time instead of ‘httpcore’, which makes ‘libraries.httpcore’ return ‘null’, causing a NPE.


(Alex Sko) #3

that was it, thank you. but I think the NPE should still be fixed in the code :slight_smile: