Skip to content

if syntax error spotless talks about google format jdk version error #761

Closed
@maxandersen

Description

@maxandersen

I had a typo in one of my java files, like:
assertEquals(lines.stream().filter(x -> x.contains("jbang run ")).count(), ;'1);

notice the extra ;'.

when running spotless I get this error:

> java.lang.Exception: You are running Spotless on JRE 8, which limits you to google-java-format 1.7
  If you upgrade your build JVM to 11+, then you can use google-java-format 1.9, which may have fixed this problem.

spent quite some time figuring out why that was happening since I'm using eclipse() in my config - but in the end it was because of the syntax error so I assume there is some bad logic around when having to show the google-java-format exception.

gradle v6, id "com.diffplug.spotless" version "5.7.0", OSX:

spotless {
	lineEndings 'UNIX'
	format 'misc', {
		target '**/*.gradle', '**/*.md', '**/.gitignore'
		targetExclude 'CONTRIBUTORS.md', 'src/main/scripts/container/README.md', 'build/container/README.md' // all-contributor bot adds non-indented code
		trimTrailingWhitespace()
		indentWithTabs(4) // or spaces. Takes an integer argument if you don't like 4
		endWithNewline()
	}
	java {
		importOrder 'java', 'javax', 'org', 'com', 'dev.jbang', ''
		removeUnusedImports()
		eclipse().configFile "misc/eclipse_formatting_nowrap.xml"
	}
	format 'xml', {
		targetExclude 'build/test-results'
		target '**/*.xml', '**/*.nuspec'
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions