Friday, October 7, 2011

Understanding Maven dependency scope

You can specify the scope for a dependency in the maven pom file, here are the scope values you can choose and what effect they have:

  • compile: This dependency is needed for compilation of the main source
  • test: This dependency is needed for compiling and running tests. It is not needed for compiling the main source or running the final artifact.
  • runtime: This dependency is needed for running the final artifact. It is not needed for compiling the main source or compiling or running the tests.
  • provided: This dependency is needed for compiling and/or running the artifact but is not necessary to include in the package, because it is provided by the runtime environment - for example, jsp-api.jar is provided by your web application container, so you don't include it in your WEB-INF/lib (for the example of a webapp); or a plugin or optional package that is a prerequisite for your application, but is not bundled with your application.
  • system: don't use this one

source: http://docs.codehaus.org/display/MAVENUSER/Dependency+Scopes

No comments:

About Me

My photo
Lead Java Developer Husband and Father

Tags