This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 5823
    
    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