wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes difference between maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "difference between maven "compile" and "provided" scope" Watch "difference between maven "compile" and "provided" scope" New topic
Author

difference between maven "compile" and "provided" scope

Eric L Zhao
Greenhorn

Joined: Jul 08, 2010
Posts: 6

Hi Guys,

I am pretty new to maven and having a difficult time to understand the difference between maven's "compile" and "provided" scope. Could someone give a clear explanation?

Thanks,

Eric
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

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".


JBoss In Action
Eric L Zhao
Greenhorn

Joined: Jul 08, 2010
Posts: 6

Thank you Peter for such clear explanation!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between maven "compile" and "provided" scope
 
Similar Threads
Maven - Compile dependency on Jar(s) inside EAR
default scope
Plugin execution not covered by lifecycle configuration
Maven : deploy libraries to WEB-INF/lib
Application and Request Scope