Difference between maven scope compile and provided for JAR packaging
2015-04-15 14:47
330 查看
compile
This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
provided
This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java
EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
Compile means that you need the JAR for compiling and running the app. For a web application, as an example, the JAR will be placed in the WEB-INF/lib directory.
Provided means that you need the JAR for compiling, but at run time there is already a JAR provided by the environment so you don't need it packaged with your app. For a web app, this means that the JAR file will not be placed into the WEB-INF/lib
directory.
For a web app, if the app server already provides the JAR (or its functionality), then use "provided" otherwise use "compile"
This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
provided
This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java
EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
Compile means that you need the JAR for compiling and running the app. For a web application, as an example, the JAR will be placed in the WEB-INF/lib directory.
Provided means that you need the JAR for compiling, but at run time there is already a JAR provided by the environment so you don't need it packaged with your app. For a web app, this means that the JAR file will not be placed into the WEB-INF/lib
directory.
For a web app, if the app server already provides the JAR (or its functionality), then use "provided" otherwise use "compile"
相关文章推荐
- [MAVEN] - Add "provided" and "test" scopes for dependency
- SQL SERVER – Difference Between EXEC and EXECUTE vs EXEC() – Use EXEC/EXECUTE for SP always
- The Difference between write through and write back for cache
- difference between Html.TextBox and Html.TextBoxFor
- Part 37 Difference between $scope and $rootScope
- Preparing for Application and Service Deployment-Differences Between the Storage Emulator and Window
- Difference Between objectForKey and valueForKey in NSDictionary
- Difference between Scopes and Namespaces in python
- Difference between href and reload for refreshing in javascript
- Key Differences Between Thin Clients and Zero Clients for VDI
- difference between "create group for any added .." and "create folder references ..."
- 【iOS】Difference Between objectForKey and valueForKey in NSDictionary
- Difference between Class.forName() and ClassLoader.loadClass()
- Difference Between Class.ForName() And ClassLoader.LoadClass() Methods In Java
- What’s the difference between Catia, SolidWorks and Inventor? Which one for me?
- What is the difference between max-device-width and max-width for mobile web?
- Difference Between objectForKey and valueForKey in NSDictionary
- What is the difference between HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR
- What's the difference between "forever" and "for good"?
- Differences between dependencymanagement and dependencies in maven