maven-jlink-plugin icon indicating copy to clipboard operation
maven-jlink-plugin copied to clipboard

Add prefix to zip entries

Open YaSuenag opened this issue 11 months ago • 3 comments

New feature, improvement proposal

maven-jlink-plugin can generate ZIP archive, but we cannot append any prefixes into it, so the user extracts the archive like JAVA_HOME image like:

bin/  conf/  legal/  lib/  release

It is better if we can add prefix like following because the user can extract files into 1 directory if the user forget to create a directory before extraction - it makes easy to manage / delete the app.

app/
├── bin/
├── conf/
├── legal/
├── lib/
└── release

YaSuenag avatar Feb 11 '25 11:02 YaSuenag

This isn't a generic zip plugin. It's specifically designed to create JLink images which happen to be zip files, I think. Do the runtime images still work if one adds a prefix inside the zip?

elharo avatar Feb 16 '25 12:02 elharo

Do the runtime images still work if one adds a prefix inside the zip?

Sure.

As I wrote in the description, this PR intends to add prefix like a parent directory. For example, I want to package jlink'ed image like this. (full of pom.xml is here )

<configuration>
    <zipDirPrefix>${imageName}/</zipDirPrefix>
    <classifier>${package.os.name}-${os.arch}</classifier>

Then the user can recognize all of artifacts are in ${imageName} directory when the user extracts the zip. The user can run the app in ${imageName}/bin/[app].

YaSuenag avatar Feb 16 '25 13:02 YaSuenag

As I wrote in the description, this PR intends to add prefix like a parent directory. For example, I want to package jlink'ed image like this. (full of pom.xml is here )

Not sure, but my approach would be:

  • unpack it to a target/app directory
  • use jreleaser to add app/bin/start.sh and app/bin/start.cmd (which then packages it for you).

bmarwell avatar Feb 23 '25 11:02 bmarwell

This issue has been resolved in https://github.com/apache/maven-jlink-plugin/commit/4ad3570632edd3ec1db6e16bba76bb86d8724db8

YaSuenag avatar Nov 11 '25 01:11 YaSuenag