2013年7月31日星期三

Maven - scope element values ??and their meanings

1, compile

defaults, belongs rely on all available in the classpath , but they can also be packed ( released with the project ) .

2, provided

JDK or a container only when the dependency has been provided until after . If servlet.jar.
For example, you developed a web application , you may need the classpath at compile Servlet API available to compile a servlet, but you do not want included in the packaged WAR The Servlet API; the Servlet API JAR determined by your application server or servlet container provides .

this range depends on the compilation classpath ( not runtime ) are available. They are not transitive , it will not be packaged .

3, runtime

for running and testing phase , for example , you may only need at compile time JDBC API JAR, and only when it is needed at run JDBC driver .

4, test

only used during testing , to compile and run the test code. Not published with the project .

5, system

and provided similar, but you must explicitly provide a JAR file for the local system path . This is done to allow compilation based on local objects , and these objects are part of the system library . This component should be always available , Maven will not go looking for it in the warehouse . If you rely on the range is set to a system-wide , you must also provide a systemPath element.

not recommended to use .

没有评论:

发表评论