1.

What is the use of an Optional Dependency?

Answer»

When splitting a project into submodules isn't practicable (for some reason), optional dependencies are EMPLOYED. The concept is that some of the dependencies are just required for particular project features and will not be required if those features are not USED. Such a feature should ideally be divided into a sub-module that is dependent on the project's main FUNCTIONALITY. Only non-optional dependencies would be included in this new subproject, as you'd NEED them all if you wanted to use the subproject's features.

If a user wants to use functionality associated with an optional dependency, they must redeclare it in their own project. Optional dependencies save storage and memory. They PREVENT troublesome jars from being packed into a WAR, EAR, fat jar, or other formats if they violate a license agreement or cause classpath difficulties.



Discussion

No Comment Found