Reputation: 489
I have two Java projects data-service app and data-report app , data service app produces certain data which is used for some processing and the data-report app should use data-service app to use the data produced by it to produce some reports, both the apps should be built as Jar file hence i am planning to use maven shade plugin as they use lot of jars.
I need to include data-service as dependency in data-report ( i cannot use any other technique like rest due to certain limitations) i have below two issues with this approach
1) Both the apps have log4j file and data.properties , both the files have properties specific to each app , can you please let me know how to handle such scenario , i tried resource-transformers but not working please let me know if anybody was successful able to use it.
2) since both apps use similar library like spring and hibernate will it eliminate duplicates ?
3) lets day i am usign gson version 1 in one app and gson versoin 1.2 how will it handle such cases ?
4) Is my approach right ? i dont want to use maven module due to some restrictions.
Upvotes: 0
Views: 89
Reputation: 35795
No, each jar should either be a library or an executable jar (not both). A library should be build without including the libraries (so no shade plugin).
So if you have classes that are used by both apps, build a third jar as a library and use it in both apps as dependency.
So either you have three different projects, or you construct a multi-module project of the three, but that is up to the circumstances.
Upvotes: 1