Cygwin NullPointerException

The following doesn’t work under Cygwin, but does under the Windows cmd.exe:

$ gradle -I init.gradle tasks -Pquickstart-version=1.0 -S
  FAILURE: Build aborted because of an internal error.
  * What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://www.gradle.org.
  * Try:
Run with --debug option to get additional debug info.
  * Exception is:
java.lang.NullPointerException
        at org.gradle.initialization.MasterDirSettingsFinderStrategy.findBeyondCurrentDir(MasterDirSettingsFinderStrategy.java:32)
        at org.gradle.initialization.AbstractSettingsFileSearchStrategyTemplate.find(AbstractSettingsFileSearchStrategyTemplate.java:32)
        at org.gradle.initialization.DefaultSettingsFinder.find(DefaultSettingsFinder.java:38)
        at org.gradle.initialization.EmbeddedScriptSettingsFinder.find(EmbeddedScriptSettingsFinder.java:33)
        at org.gradle.initialization.SettingsHandler.findSettings(SettingsHandler.java:90)
        at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:77)
        at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:46)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:133)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
        at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
        at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
        at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
        at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:233)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:217)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
        at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
        at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
        at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
        at org.gradle.launcher.Main.main(Main.java:39)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
        at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
    BUILD FAILED
  Total time: 1.452 secs
      $ gradle -version
  ------------------------------------------------------------
Gradle 1.0-milestone-6
------------------------------------------------------------
  Gradle build time: Thursday, November 17, 2011 5:54:12 AM UTC
Groovy: 1.8.4
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_27 (Sun Microsystems Inc. 20.2-b06)
OS: Windows 7 6.1 amd64

This is using the project located in https://bitbucket.org/mmaxey/gradle-java-quickstart/src

I suspect this is already fixed in milestone-7. Could you give this snapshot a try: http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-7-20111209194225+0100-bin.zip

Bad news: it failed with a different exception under Cygwin, Powershell, and cmd.exe:

$ gradle -version
  ------------------------------------------------------------
Gradle 1.0-milestone-7-20111212000014+0100
------------------------------------------------------------
  Gradle build time: Sunday, December 11, 2011 11:00:14 PM UTC
Groovy: 1.8.4
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_27 (Sun Microsystems Inc. 20.2-b06)
OS: Windows 7 6.1 amd64
    mmaxey@GARL-ISFL007993 /cygdrive/c/Users/mmaxey/Documents/quickstart
$ gradle -I init.gradle tasks -Pquickstart-version=1.0 -S
:buildSrc:clean
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes
:buildSrc:jar
:buildSrc:assemble
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test
:buildSrc:check
:buildSrc:build
  FAILURE: Build failed with an exception.
  * Where:
Build file 'C:\Users\mmaxey\Documents\quickstart\build.gradle' line: 5
  * What went wrong:
A problem occurred evaluating root project 'quickstart'.
Cause: org/gradle/api/internal/resource/ResourceException
  * Try:
Run with --info or --debug option to get more log output.
  * Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'quickstart'.
        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.evaluate(BuildScriptProcessor.java:38)
        at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:475)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:74)
        at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
        at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
        at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)
        at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)
        at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:451)
        at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:446)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:137)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:108)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:76)
        at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
        at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
        at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
        at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:239)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:223)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
        at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
        at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
        at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
        at org.gradle.launcher.Main.main(Main.java:39)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
        at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: java.lang.NoClassDefFoundError: org/gradle/api/internal/resource/ResourceException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin.class$(ArtifactoryPlugin.groovy)
        at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin.$get$$class$org$jfrog$gradle$plugin$artifactory$extractor$BuildInfoTask(ArtifactoryPlugin.groovy)
        at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin.createBuildInfoTask(ArtifactoryPlugin.groovy:143)
        at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin$createBuildInfoTask.callCurrent(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin.apply(ArtifactoryPlugin.groovy:47)
        at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin.apply(ArtifactoryPlugin.groovy)
        at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.providePlugin(DefaultProjectsPluginContainer.java:107)
        at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.addPluginInternal(DefaultProjectsPluginContainer.java:71)
        at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
        at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:846)
        at org.gradle.api.Project$apply.call(Unknown Source)
        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:35)
        at org.gradle.api.Script$apply.callCurrent(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
        at build_5m0on46jt8hrhidkd3pd27nk8u.run(C:\Users\mmaxey\Documents\quickstart\build.gradle:5)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
        ... 34 more
Caused by: java.lang.ClassNotFoundException: org.gradle.api.internal.resource.ResourceException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 61 more
    BUILD FAILED
  Total time: 8.084 secs

Looks like a problem with the artifactory plugin. Can you disable it temporarily, to see if the original problem is fixed?

Hey Mark!

I think I know what is the second problem. It appears that artifactory plugin was dependent on some internal API that has changed recently. Do you mind trying again with this snapshot: http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-7-20111213140403+0100-all.zip

Alternatively, tell me how to reproduce it :slight_smile: If I try runnning gradle-java-quickstart according to the steps you mentioned earlier I hit this: java.io.FileNotFoundException: http://repo.jfrog.org/artifactory/libs-snapshots-local/org/jfrog/buildinfo/build-info-extractor-gradle/2.0.x-SNAPSHOT/build-info-extractor-gradle-2.0.x-20111123.143146-11-uber.jar

Good news! I downloaded the latest snapshot of Gradle (1.0-milestone-7-20111214110828+0100) and pointed at the latest artifactory plugin release (2.0.7) and it seems to work in Cygwin.

The only difference I see is that Cygwin doesn’t color the “tasks” output like cmd.exe or Powershell. Is there some shell setting I’m missing? I’m using whatever defaults comes with Cygwin.