MCPcopy Create free account
hub / github.com/cloudfoundry/java-buildpack / Supply

Method Supply

src/java/frameworks/java_cf_env.go:49–83  ·  view source on GitHub ↗

Supply installs the java-cfenv JAR

()

Source from the content-addressed store, hash-verified

47
48// Supply installs the java-cfenv JAR
49func (j *JavaCfEnvFramework) Supply() error {
50 j.context.Log.Debug("Installing Java CF Env")
51
52 dependency := "java-cfenv"
53 defaultVersion := "4.0.0"
54 versionPattern := "4.x.x"
55
56 if j.isSpringBootMajor(3) {
57 defaultVersion = "3.5.1"
58 versionPattern = "3.x.x"
59 }
60
61 allVersions := j.context.Manifest.AllDependencyVersions(dependency)
62 resolvedVersion, err := libbuildpack.FindMatchingVersion(versionPattern, allVersions)
63
64 dep := libbuildpack.Dependency{Name: dependency, Version: resolvedVersion}
65 if err != nil {
66 j.context.Log.Warning("Unable to determine Java CF Env version for pattern %s, using default", versionPattern)
67 dep = libbuildpack.Dependency{
68 Name: dependency,
69 Version: defaultVersion,
70 }
71 } else {
72 j.context.Log.Debug("Resolved Java CF Env version pattern '%s' to %s", versionPattern, resolvedVersion)
73 }
74
75 // Install java-cfenv JAR
76 javaCfEnvDir := filepath.Join(j.context.Stager.DepDir(), "java_cf_env")
77 if err := j.context.Installer.InstallDependency(dep, javaCfEnvDir); err != nil {
78 return fmt.Errorf("failed to install Java CF Env: %w", err)
79 }
80
81 j.context.Log.Debug("Installed Java CF Env version %s", dep.Version)
82 return nil
83}
84
85// Finalize performs final java-cfenv configuration
86func (j *JavaCfEnvFramework) Finalize() error {

Callers

nothing calls this directly

Calls 4

isSpringBootMajorMethod · 0.95
AllDependencyVersionsMethod · 0.65
DepDirMethod · 0.65
InstallDependencyMethod · 0.65

Tested by

no test coverage detected