fix(java): support Zulu builds

resolves #1202
This commit is contained in:
Jan De Dobbeleer 2021-11-10 19:54:57 +01:00 committed by Jan De Dobbeleer
parent 274f800ae2
commit 2d3b6e4e23
2 changed files with 6 additions and 1 deletions

View file

@ -11,7 +11,7 @@ func (j *java) string() string {
}
func (j *java) init(props *properties, env environmentInfo) {
javaRegex := `(?: JRE) \((?P<version>(?P<major>[0-9]+)(?:\.(?P<minor>[0-9]+))?(?:\.(?P<patch>[0-9]+))?).*\),`
javaRegex := `(?: JRE)(?: \(.*\))? \((?P<version>(?P<major>[0-9]+)(?:\.(?P<minor>[0-9]+))?(?:\.(?P<patch>[0-9]+))?).*\),`
javaCmd := &cmd{
executable: "java",
args: []string{"-Xinternalversion"},

View file

@ -15,6 +15,11 @@ func TestJava(t *testing.T) {
JavaHomeVersion string
JavaHomeEnabled bool
}{
{
Case: "Zulu LTS",
ExpectedString: "11.0.13",
Version: "OpenJDK 64-Bit Server VM (11.0.13+8-LTS) for windows-amd64 JRE (Zulu11.52+13-CA) (11.0.13+8-LTS), built on Oct 7 2021 16:00:23 by \"zulu_re\" with MS VC++ 15.9 (VS2017)", // nolint:lll
},
{
Case: "OpenJDK macOS",
ExpectedString: "1.8.0",