There is a Fat Jar, built with Spring Boot and Maven. Its internal structure can be explored, using Java Decompiler. Notice the "lib" node, which is supposed to contain all libraries needed to run the Fat Jar.
The Fat Jar can execute successfully under JDK/JRE 1.8 as a standalone application. Using 7z, one can extract the Fat Jar and collect all libraries embedded in it.
I have the source code (Maven with POM.XML) that was used to build the Fat Jar, and I would like to modify it (no new additional library added). Put it simply, comment a few line of code, then recompile it (it will be again a Fat Jar).
Question: The problem is: when recompiling the source code (command: mvn package
), one of repository is no longer accessible from Internet. Is there a definite way (step by step) to recompile? In theory, this should be possible as we already have all needed libraries to run the Jar (thanks to "Fat Jar" feature).
My Attempt:
- Extract the Fat Jar.
- Using
mvn install:install-file -Dfile=<path-to-file>
to install one by one library into local Maven repository (c:\Users\[username]\.m2\repository\
). Then later, I can executemvn package
against the main source code, with the assumption that all libraries needed are available in the local Maven repo; thus, no need to fetch it from Internet. - But I got a lot of problems, e.g. 'groupId' is missing.
You need to
install:install-file
the missing libraries to your local repository and set the GAV (groupId, artifactId, version) correctly when installing it.Generally, I would also check if there is an easier way to solve your problem than patching the library.