简体   繁体   English

用Maven重新打包已构建的JAR

[英]Repack the built JAR with maven

What is the easiest way to repack a JAR that was built with an external packaging tool? 重新打包使用外部打包工具构建的JAR的最简单方法是什么?

So I have a tool that compiles and packages a library into a jar (execution is called in prepare-package phase). 因此,我有一个可将库编译并打包到jar中的工具(在prepare-package阶段称为执行)。 I want to unzip the jar and repack it again with maven-jar-plugin. 我想解压缩jar并使用maven-jar-plugin重新包装。 What would be the easiest way to do that? 最简单的方法是什么?

I don't see why you'd want to repackage a JAR, unless you want to modify its manifest or add some resources... 我不知道为什么要重新打包JAR,除非您想修改它的清单或添加一些资源...

Anyway, you could use the unpack goal of the maven-dependency-plugin to unpack that JAR to a given directory, eg the target/classes directory containing some other resources of your current project. 无论如何,您可以使用maven-dependency-plugin拆包目标将该JAR拆包到给定目录,例如,包含当前项目中其他资源的target/classes目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM