diff --git a/maven/build.go b/maven/build.go index 76e1a55..c71b557 100644 --- a/maven/build.go +++ b/maven/build.go @@ -119,7 +119,7 @@ func (b Build) Build(context libcnb.BuildContext) (libcnb.BuildResult, error) { if _, found, err := pr.Resolve(PlanEntryJVMApplicationPackage); err != nil { return libcnb.BuildResult{}, fmt.Errorf("unable to resolve JVM Application Package plan entry\n%w", err) } else if found { - bomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.NewExecutor(), b.Logger) + bomScanner := sbom.NewSyftCLISBOMScanner(context.Layers, effect.CommandExecutor{}, b.Logger) // build a layer contributor to run Maven a, err := b.ApplicationFactory.NewApplication( diff --git a/maven/maven_manager_test.go b/maven/maven_manager_test.go index 492f395..25b6720 100644 --- a/maven/maven_manager_test.go +++ b/maven/maven_manager_test.go @@ -20,9 +20,9 @@ func testMavenManager(t *testing.T, context spec.G, it spec.S) { var ( Expect = NewWithT(t).Expect - ctx libcnb.BuildContext - mavenManager maven.MavenManager - mvnwFilepath string + ctx libcnb.BuildContext + mavenManager maven.MavenManager + mvnwFilepath string mvnwPropsPath string ) @@ -36,10 +36,12 @@ func testMavenManager(t *testing.T, context spec.G, it spec.S) { Expect(err).NotTo(HaveOccurred()) mvnwFilepath = filepath.Join(ctx.Application.Path, "mvnw") - mvnwPropsPath = filepath.Join(ctx.Application.Path, ".mvn/wrapper/") - + mvnwPropsPath = filepath.Join(ctx.Application.Path, ".mvn/wrapper/") + err = os.MkdirAll(mvnwPropsPath, 0755) Expect(err).NotTo(HaveOccurred()) + + t.Setenv("BP_ARCH", "amd64") }) it.After(func() { @@ -273,13 +275,13 @@ func testMavenManager(t *testing.T, context spec.G, it spec.S) { it("converts CRLF formatting in the maven-wrapper.properties file to LF (unix) if present", func() { propsFile := filepath.Join(mvnwPropsPath, "maven-wrapper.properties") Expect(os.WriteFile(propsFile, []byte("test\r\n"), 0755)).To(Succeed()) - + _, _, _, err := mavenManager.Install() - Expect(err).NotTo(HaveOccurred()) + Expect(err).NotTo(HaveOccurred()) - contents, err := os.ReadFile(propsFile) - Expect(err).NotTo(HaveOccurred()) - Expect(bytes.Compare(contents, []byte("test\n"))).To(Equal(0)) + contents, err := os.ReadFile(propsFile) + Expect(err).NotTo(HaveOccurred()) + Expect(bytes.Compare(contents, []byte("test\n"))).To(Equal(0)) }) })