Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ instance:

java:
# Require following versions before e.g running AEM instances
version_constraints: ">= 11, < 12"
version_constraints: [">= 1.8, < 1.9", ">= 11, < 12", ">= 17, < 18", ">= 21, < 22"]

# Pre-installed local JDK dir
# a) keep it empty to download open source Java automatically for current OS and architecture
Expand Down Expand Up @@ -478,7 +478,7 @@ vendor:
# JDK used to: run AEM instances, build OSGi bundles, assemble AEM packages
java:
# Require following versions before e.g running AEM instances
version_constraints: ">= 11, < 12"
version_constraints: [">= 1.8, < 1.9", ">= 11, < 12", ">= 17, < 18", ">= 21, < 22"]

# Pre-installed local JDK dir
# a) keep it empty to download open source Java automatically for current OS and architecture
Expand Down
2 changes: 1 addition & 1 deletion examples/docker/src/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ vendor:
# JDK used to: run AEM instances, build OSGi bundles, assemble AEM packages
java:
# Require following versions before e.g running AEM instances
version_constraints: ">= 11, < 12"
version_constraints: [">= 1.8, < 1.9", ">= 11, < 12", ">= 17, < 18", ">= 21, < 22"]

# Pre-installed local JDK dir
# a) keep it empty to download open source Java automatically for current OS and architecture
Expand Down
2 changes: 1 addition & 1 deletion pkg/cfg/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *Config) setDefaults() {
v.SetDefault("vendor.quickstart.license_file", common.QuickstartLicenseFile)

v.SetDefault("vendor.java.home_dir", "")
v.SetDefault("vendor.java.version_constraints", ">= 11, < 12")
v.SetDefault("vendor.java.version_constraints", []string{"=> 1.8, < 1.9", "=> 11, < 12", ">= 17, < 18", "=> 21, < 22"})
v.SetDefault("vendor.java.download.url", c.tplString("https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.25%2B9/OpenJDK11U-jdk_[[.Arch]]_[[.Os]]_hotspot_11.0.25_9.[[.ArchiveExt]]"))
v.SetDefault("vendor.java.download.replacements", map[string]string{"darwin": "mac", "x86_64": "x64", "amd64": "x64", "386": "x86-32", "arm64": "x64", "aarch64": "x64"})

Expand Down
19 changes: 11 additions & 8 deletions pkg/java_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type JavaManager struct {
HomeDir string
DownloadURL string
DownloadURLReplacements map[string]string
VersionConstraints string
VersionConstraints []string
}

func NewJavaManager(manager *VendorManager) *JavaManager {
Expand All @@ -34,7 +34,7 @@ func NewJavaManager(manager *VendorManager) *JavaManager {
HomeDir: cv.GetString("vendor.java.home_dir"),
DownloadURL: cv.GetString("vendor.java.download.url"),
DownloadURLReplacements: cv.GetStringMapString("vendor.java.download.replacements"),
VersionConstraints: cv.GetString("vendor.java.version_constraints"),
VersionConstraints: cv.GetStringSlice("vendor.java.version_constraints"),
}
}

Expand Down Expand Up @@ -119,16 +119,19 @@ func (jm *JavaManager) checkVersion() error {
if err != nil {
return err
}
if jm.VersionConstraints != "" {
versionConstraints, err := version.NewConstraint(jm.VersionConstraints)
if len(jm.VersionConstraints) == 0 {
return nil
}
for _, vc := range jm.VersionConstraints {
vco, err := version.NewConstraint(vc)
if err != nil {
return fmt.Errorf("java version constraint '%s' is invalid: %w", jm.VersionConstraints, err)
return fmt.Errorf("java version constraint '%s' is invalid: %w", vc, err)
}
if !versionConstraints.Check(currentVersion) {
return fmt.Errorf("java current version '%s' does not meet contraints '%s'", currentVersion, jm.VersionConstraints)
if vco.Check(currentVersion) {
return nil
}
}
return nil
return fmt.Errorf("java current version '%s' does not meet contraints '%s'", currentVersion, strings.Join(jm.VersionConstraints, " || "))
}

func (jm *JavaManager) FindHomeDir() (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/project/app_classic/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ vendor:
# JDK used to: run AEM instances, build OSGi bundles, assemble AEM packages
java:
# Require following versions before e.g running AEM instances
version_constraints: ">= 11, < 12"
version_constraints: [">= 1.8, < 1.9", ">= 11, < 12", ">= 17, < 18", ">= 21, < 22"]

# Pre-installed local JDK dir
# a) keep it empty to download open source Java automatically for current OS and architecture
Expand Down
2 changes: 1 addition & 1 deletion pkg/project/app_cloud/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ vendor:
# JDK used to: run AEM instances, build OSGi bundles, assemble AEM packages
java:
# Require following versions before e.g running AEM instances
version_constraints: ">= 11, < 12"
version_constraints: [">= 1.8, < 1.9", ">= 11, < 12", ">= 17, < 18", ">= 21, < 22"]

# Pre-installed local JDK dir
# a) keep it empty to download open source Java automatically for current OS and architecture
Expand Down
2 changes: 1 addition & 1 deletion pkg/project/instance/aem/default/etc/aem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ vendor:
# JDK used to: run AEM instances, build OSGi bundles, assemble AEM packages
java:
# Require following versions before e.g running AEM instances
version_constraints: ">= 11, < 12"
version_constraints: [">= 1.8, < 1.9", ">= 11, < 12", ">= 17, < 18", ">= 21, < 22"]

# Pre-installed local JDK dir
# a) keep it empty to download open source Java automatically for current OS and architecture
Expand Down
Loading