Requirement:
To create a patch (with required classes alone)
I tried like this:
path/to/files
folderjar cvf patch.jar -C path/to/files
When I decompile the class files via Intellij from the first jar's class files, I could see the correct code more or less. But when I check from the second jar file the code is different.
Is it because in the second jar it is being compiled into byte format again? If so are there any consequence of this? The reason why I create a second jar is because I only need those specific class files in the folder as we use it as a patch.
Or is there any way to create a patch?
Here's my suggestion.
How?
patch-of-your-project-name
patch-of-...
This way, build errors can be noted/logged easily and you can also automate the process by providing the required files list to a script and then do the maven build.
Note: There's a maven plugin maven-patch-plugin
. Please check if you can make use of it.
https://maven.apache.org/plugins/maven-patch-plugin/
Remove from the jar A jar is just a zip file after all. Remove a single file from existing jar. Definitely much faster than uncompressing/recompressing too.
zip -d file.jar unwanted_file.txt
Add to the jar Add class to a new jar
jar uf C:\folder\where\jar\is\the_jar_file.jar file.class
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.