I have a multi-module maven project. The parent POM and individual module's pom are working fine (because code in each module runs fine without any dependency issue and mvn:package
goal runs without any warning/error). Now, I needed to create a jar for each module.
Project structure with their dependencies is roughly like this
ProjectABC
|
|--ModuleA
| |-Log4J
| |-Guava
| |-pom.xml
|
|--ModuleB
| |-ModuleA
| |-Commons
| |-pom.xml
|
|
|--MoudleC
| |-ModuleB
|
|-pom.xml
I followed this Maven multi-module project - copying all "package" JARS from submodules into parent/target/
And, able to get all my sub-module's jar into a mouduleJars
folder, but I cannot run any jars because none of module's dependencies gets copied in a mouduleJars
folder. For example if module A
is dependent on Log4J
I don't get log4j.jar in my mouduleJars
folder, neither log4J is packaged inside moduleA.jar
Question
How to create self containing (standalone module jars) in a multi-module project.
Or, how to get all the dependencies in a lib
folder.
Temporary workaround
Right now, I use my IntelliJ IDEA ide to copy all dependencies (like log4J, Guvava etc) in a lib folder
and run maven generated moduleA.jar
by adding the lib
folder to the classpath. This runs fine, but I don't like this manual approach and wants maven to take care of it.
For who think it is duplicate or already answered and downvoters
My question is NOT asking Maven Assembly Submodules Multimodules Or this
Maven : Multimodule projects and versioning
I have already spent more than a day try to get this working with maven-assembly-plugin
without any success.
Please let me know if need more details.