Reputation: 11377
Given our maven projet provides some api for clients to interact with it, those are just few java interfaces which are implemented in interal codebase...
Now if we just build the jar and publish it anyone can see the internal classes we used for implementation, yet we only need few java interfaces to be published (along with few DTO classes maybe)...
Is it possible to pick exactly which java files we want to build jar for and create two artifacts like (product.jar/war and product-api.jar)
Prupose is to limit possible misuse of the code by other teams...
Upvotes: 0
Views: 1388
Reputation: 2924
Your question is about securing code instead of maven in general. You can have multi-module maven project but still anyone can download that and decomopile it. Few thoughts as Java does have inbuilt mechanism to support this but there are workarounds...some thoughts..
Upvotes: 1
Reputation: 97487
The best is to make separate modules in Maven which represent your modules like:
project-api
which contains only the interfaces and which can be used by others separately.
project-impl
one implementation etc. The above makes testing easier etc. is a good choice with regards to separation of concerns.
Upvotes: 2