Home > Net >  Make imported jar file depend on other dependencies in project rather than making its own dependenci
Make imported jar file depend on other dependencies in project rather than making its own dependenci

Time:05-10

I have intelliJ project A that has an imported external jar file (made from project B, jar file and gradle setup made by some other dev) that looks like this:

enter image description here

I want to replace that jar with a different jar I made from project B (where I modified some code).

Project B's main module looks like this:

enter image description here

Then when I make a jar file for it selecting main as the module (I don't select a class): enter image description here

And import the jar into project A, it comes out like this with a lot more folders than just the com:

enter image description here

I'm guessing this is because Project B has a lot of other dependencies that it depends on so when it makes that jar file it needs to include those other folders for it to rely on. The thing is, a lot of those dependencies are included in project A. Does anyone know how to make it so the jar file only looks like the first picture posted at the top and it depends on the other dependencies already included in project A?

CodePudding user response:

A JAR file is in reality just a different name for a ZIP file (plus an optional manifest file). All you need to do is put your .class files from Project B in a zip file (in the right directory/ies) and then change the extension to .jar

  • Related