Hi,

since 35991d5eab0f3be67adc6bbaf9db743b94585674 I get these errors when running Gradle tasks. Even with --no-scan applied. Locally, I don't want to generate build-scans generally, so I wonder if there is something I've been missing.

``` Build scan background action failed. org.gradle.process.internal.ExecException: Process 'command 'git'' finished with non-zero exit value 128 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:417) at org.gradle.process.internal.DefaultExecAction.execute(DefaultExecAction.java:38) at org.gradle.process.internal.DefaultExecActionFactory.exec(DefaultExecActionFactory.java:152) at io.spring.ge.BuildScanConventions.exec(BuildScanConventions.java:162) at io.spring.ge.BuildScanConventions.addGitMetadata(BuildScanConventions.java:111) at com.gradle.scan.plugin.internal.api.j.a(SourceFile:22) at com.gradle.scan.plugin.internal.api.k$a.a(SourceFile:112) at com.gradle.scan.plugin.internal.api.h.a(SourceFile:61) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) ````

EDIT: It seems that the git command is executed on a non git directory - although I don't see on which.

Cheers, Christoph

Comment From: wilkinsona

From what directory are you running the build when that git failure occurs?

Comment From: dreis2211

The directory where I've checked out Spring-Boot. Running on a Mac - if that helps.

Comment From: wilkinsona

Interesting, thanks. I can reproduce it by running the build from outside the repository, but not using something like ./gradlew build.

Comment From: dreis2211

I wonder if that's problematic https://github.com/spring-gradle-plugins/gradle-enterprise-conventions-plugin/blob/5eab9151f0ae1d0b4e48cbe99bf64ccf98b27600/src/main/java/io/spring/ge/BuildScanConventions.java#L165

Comment From: wilkinsona

Yeah, I'm pretty sure that's the cause, but I don't understand why you and I are apparently affected differently.

Comment From: dreis2211

Switched to Java 8 and it works.

Comment From: wilkinsona

Thanks, @dreis2211. I was using Java 8. Switching to 11, I see the same behaviour as you. I don't understand why the working directory changes as a result of switching from 8 to 11, but at least I could now verify that the change I was planning to make fixes the problem that you are seeing.

Comment From: dreis2211

I have no clue either. Glad you found a fix already. I wonder if we can skip the whole logic anyway if --no-scan is applied?

Comment From: wilkinsona

@dreis2211 This should be fixed as of ea5dfde. Please let me know if that's the case for you and I'll cut another release of the plugin.

Comment From: dreis2211

@wilkinsona Works like a charm. I'm also still investigating why JDK 11 makes a difference here.

Comment From: dreis2211

I wonder if it's related to JDK-8194154 and Gradle relying on changing user.dir somewhere. Anyhow, good that it is working now. Highly appreciated

Comment From: MarceloLaser

I am having this exact same problem when attempting to build the spring-boot-2.7.2 release. Since this seems to have been the cause last time, my local JDK version is 13.0.2, 2020-01-14.

Comment From: wilkinsona

@MarceloLaser Can you please tell us the following:

  • The command that you're using to run the build
  • The directory in which you're executing the command
  • The OS that you're using
  • The output of git --version

Comment From: MarceloLaser

I'm using .\gradlew build inside the root directory extracted from the source.zip of release v.2.7.2. The OS is Windows 10, git version is 2.37.1.windows.1.

I've attached the full error log below. I realize now that the error may be due to the directory not being initialized as a git repository (since I did not technically clone it as one), but then this would make building older releases of spring-boot rather difficult, so I'm guessing there must be a way around that.

spring-boot-2.7.2-errorlog.txt

Comment From: wilkinsona

I realize now that the error may be due to the directory not being initialized as a git repository

Yes, that will be the cause. https://github.com/spring-io/gradle-enterprise-conventions/issues/54 is tracking some improvements in this area. The error is benign so you can ignore it for now.

but then this would make building older releases of spring-boot rather difficult

We recommend using git for this. You can git clone the repository and then check out the tag for the version that you want to build. You should configure git with core.autocrlf set to true to ensure that line endings aren't mangled. I suspect incorrect line endings is what is causing the formatting errors that you're seeing at the moment.