I have to create a java project where the structure will be like the below image:
That is the project will have a common folder that will contain mainly the framework. Then there will be different modules that are dependent on the common framework and will have their own framework. How do I set such dependency using maven/sbt? The project should be structured in a way so that:
What am I looking for is how do I have different pom.xml/build.sbt in each level and link their dependencies?
Can you please suggest any solution?
The most important thing was already said by Andreas:
Your "framework" needs to a module like everything else. So your main project will have four modules:
framework
module1
module2
module3
The main POM will list those four as modules.
framework
will contain the code of the framework. module1
will also contain no code, but two submodules for module1-framework
and module1a
. The POM of module1
will define those modules.
If you build the project you get jars for each and every of the (sub)modules.
You can use the assembly plugin or the shade plugin to bundle some of these to larger jars (even for the whole project), but this is rarely useful. Maven is good a dependency resolution, to there is no real need to bundle a lot of jars into one (with the exception of executable jars).
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.