maven中的Dependency scope

上一篇 / 下一篇  2011-11-01 19:01:48 / 个人分类:Maven

 

mavenDependency scope

compile– 这是缺省scope,表明是所有任务所需的资源。“Compiledependencies are available in all classpaths.

provided– 表示该dependencyJDK部分或应用服务器的classpath里已经自带的资源,例如EJBdependency jars,只需要在compile时使用,在例如打包时就不应该把它打包进jar, war or ear里,因为JDK or APP SERVER里本身就有。

runtime - this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.

test– 表示该dependency只会在test compilation and execution phases使用。例如在使用junit依赖时,scope参数的值为test来告诉Maven这个依赖项只是在测试阶段所需的,而不是运行时所需的资源

system,类似provided,需要显式提供包含依赖的jarMaven不会在Repository中查找它


TAG:

 

评分:0

我来说两句

Open Toolbar