Skip to content

JarArchiver lacks Maven Toolchains support #238

@onkobu

Description

@onkobu

It could be a bit late or I missed a discussion that took place before 2016. But I assume I found the reason for https://issues.apache.org/jira/browse/MJAR-62 resp. https://issues.apache.org/jira/browse/MJAR-289.

I'd really like to take part in this but maybe found fundamental issues. It'd be great if somebody with insight to the history could read through my lengthy comment in the bug. To sum it up:

  • JarArchiver directly controls ZIP-related classes from the JDK/ Classloader running it
  • Maven also supports toolchains creating a totally separate execution context
  • MavenArchiver (of https://github.com/apache/maven-archiver) relies directly on JarArchiver
  • both, MavenArchiver and JarArchiver are put together by maven-jar-plugin based on a map of Archiver instances that luckily may contain something for the key jar or mjar

It seems pretty obvious that a toolchain with a path to another JDK than the one in use to run Maven may ship as many jar commands as it likes. It has zero effect on JarArchiver. In addition the combination of MavenArchiver and JarArchiver is not meant to use an outbound jar command especially not if this determined during runtime (of Maven itself).

I can think of two options: provide a JarArchiver that wraps a jar command supplied during runtime with a default pointing to the current JDKs variant. Or a sidechannel for maven-jar-plugin to switch to a new implementation of creating JARs based on the jar command of the toolchain available.

Whereas the first option requires way more implementation effort and solves all the issues the second fixes class format issues of manifests only in conjunction with toolchains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions