executable-jar icon indicating copy to clipboard operation
executable-jar copied to clipboard

Enable detect to support multiple jar files

Open dmikusa opened this issue 2 years ago • 6 comments

What happened?

The executable jar buildpack will detect if you either:

  1. Build from source code and the build output is either a single executable JAR or multiple files that only contain a single executable JAR
  2. Build with a pre-compiled asset that is a single executable JAR file

In some cases, you may want to compile locally but build an image from a directory or archive that is not an executable JAR. This is not presently possible because detect.go looks for /workspace/META-INF/MANIFEST.MF, which will only exist if the asset being provided to build is an executable JAR.

This enhancement request is to have detect also look at the present workspace and see if either a.) the workspace itself has a manifest or if b.) it can identify a single executable JAR file in the workspace.

dmikusa avatar May 24 '22 15:05 dmikusa

it's a duplicate of https://github.com/paketo-buildpacks/executable-jar/issues/206 , right? should we close it?

anthonydahanne avatar Dec 19 '23 03:12 anthonydahanne

I don't think they are duplicates. #206 is a problem that occurs when you have an intended executable JAR but then one of the dependencies of that executable JAR is also executable. The buildpack may sometimes select the wrong JAR to execute. There's no way to tell the buildpack to pick a particular JAR, so that issue is to add a way to select the specific JAR to execute.

Presently, you can only hit the previous issue if you build from source. This one is to change detect so that you could build source code locally and package an image from say a directory of JAR files you built. There's probably not a huge need for this issue, #206 is definitely more important.

dmikusa avatar Dec 23 '23 03:12 dmikusa

The executable jar buildpack will detect if you either:

... Build with a pre-compiled asset that is a single executable JAR file

But that is not true, right? I see it as a bug in the detect logic. This is fixed by #265.

c0d1ngm0nk3y avatar May 15 '24 08:05 c0d1ngm0nk3y

I'm trying to understand what's left of this issue after https://github.com/paketo-buildpacks/executable-jar/pull/265 was merged.

From what I understood users can already provide BP_EXECUTABLE_JAR_LOCATION to specify where to look for JARs or let the buildpack pick the first executable JAR it can find.

modulo11 avatar Jul 19 '24 11:07 modulo11

@modulo11 we'll probably release with #265 this week, please test it out and let us know if this issue is fixed! Thanks

anthonydahanne avatar Jul 22 '24 20:07 anthonydahanne

If workspace/META-INF/MANIFEST.MF is present, BP_EXECUTABLE_JAR_LOCATION has no effect. If it's not present, auto-detection and overwriting that using BP_EXECUTABLE_JAR_LOCATION works fine.

@anthonydahanne If that's the anticipated behavior, we can close this issue. However, I'd expect that BP_EXECUTABLE_JAR_LOCATION should always work.

modulo11 avatar Aug 02 '24 08:08 modulo11