I am building a rest API for a previous project. If I add it as dependency to my new rest API project, will all the functionality will be added to my rest API jar file or only the methods which I use? My old project jar is 181M, so the whole will be added to Rest API jar?
Thanks,
Without special configuration, Maven will not include any dependencies in your jar at all. Just the compiled classes from your source code (and generated classes) are included. If you want to include dependencies, you have to tell maven using the maven-assembly-plugin
, as described in How can I create an executable JAR with dependencies using Maven?. When you use a different packaging, the dependencies can be included automatically, depending on the packaging type. E. g. when using war
, all compile
dependencies are added to WEB-INF/lib
.
When you include dependencies, always the complete dependency-jar is added to your jar. There will be no checking, if everything is needed. So, your resulting jar will contain all 181M of dependencies as well as the source code of the new project.