`
jbeduhai
  • 浏览: 497244 次
  • 性别: Icon_minigender_1
  • 来自: 山东
社区版块
存档分类
最新评论

Maven-pom.xml -Dependency Scope 区别

 
阅读更多
如下图报错,找错
1. 找不到类  org.springframework.scheduling.quartz.QuartzJobBean

2.Ctrl+Shift+T  查 QuartzJobBean  是属于在哪个jar包下的类,
如下图



QuartzJobBean  属于spring-support-2.0.8.jar

scope的使用场景和说明

1.compile

编译范围,默认scope,在工程环境的classpath(编译环境)和打包(如果是WAR包,会包含在WAR包中)时候都有效。

2.provided

容器或JDK已提供范围,表示该依赖包已经由目标容器(如tomcat)和JDK提供,只在编译的classpath中加载和使用,打包的时候不会包含在目标包中。最常见的是j2ee规范相关的servlet-api和jsp-api等jar包,一般由servlet容器提供,无需在打包到war包中,如果不配置为provided,把这些包打包到工程war包中,在tomcat6以上版本会出现冲突无法正常运行程序(版本不符的情况)。

3.runtime

一般是运行和测试环境使用,编译时候不用加入classpath,打包时候会打包到目标包中。一般是通过动态加载或接口反射加载的情况比较多。也就是说程序只使用了接口,具体的时候可能有多个,运行时通过配置文件或jar包扫描动态加载的情况。典型的包括:JDBC驱动等。

4.test

测试范围,一般是单元测试场景使用,在编译环境加入classpath,但打包时不会加入,如junit等。

5.system

系统范围,与provided类似,只是标记为该scope的依赖包需要明确指定基于文件系统的jar包路径。因为需要通过systemPath指定本地jar文件路径,所以该scope是不推荐的。如果是基于组织的,一般会建立本地镜像,会把本地的或组织的基础组件加入本地镜像管理,避过使用该scope的情况。

6.import

(仅在 Maven 2.0.9 或者更新版本中有效)

  • 大小: 30.3 KB
分享到:

相关推荐

    springside-core-4.2.2.GA(含关联的test.jar)

    pom.xml配置 <springside.version>4.2.2.GA</springside.version> <dependency> <groupId>org.springside <artifactId>springside-core ${springside.version} <classifier>tests <scope>test</scope> ...

    maven-ant-tasks-2.1.3-src

    The Mavent Ant Tasks allow several of Maven's artifact handling features to be used from within an Ant build. These include: ...POM processing - for reading and writing a Maven 2 pom.xml file

    spring-boot-reference.pdf

    15.2. Importing XML Configuration 16. Auto-configuration 16.1. Gradually Replacing Auto-configuration 16.2. Disabling Specific Auto-configuration Classes 17. Spring Beans and Dependency Injection 18. ...

    ojdbc14-10.2.0.2.0.jar

    亲测有效。具体操作如下: (1)把ojdbc14-10.2.0.2.0...(2)pom.xml文件中,添加 <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14 <version>10.2.0.2.0 <scope>provided</scope> </dependency>

    autoconfig-demo.zip

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...

    打jar包注意点.docx

    1、先在pom.xml文件中加入<build></build>标签 <groupId>org.apache.maven.plugins <artifactId>maven-jar-plugin <version>2.3.1 <!--运行jar包时运行的主类,要求类全名--> ...

    maven-ant-tasks-2.1.3

    The Mavent Ant Tasks allow several of Maven's artifact handling features to be used from within an Ant build. These include: ...POM processing - for reading and writing a Maven 2 pom.xml file

    Maven权威指南 很精典的学习教程,比ANT更好用

    Maven权威指南 Authors Tim O'Brien (Sonatype, Inc.) , John Casey (Sonatype, Inc.) , Brian Fox (Sonatype, Inc.) , Bruce Snyder () , Jason Van Zyl (Sonatype, Inc.) , Juven Xu () Abstract Maven权威指南...

    apache-maven-3.0.2-bin

    * [MNG-4953] - Issue a warning when a system-scope dependency refers to the project basedir ** New Feature * [MNG-4936] - Allow to better monitor and adjust a Maven build during CI * [MNG-4937] - ...

    springboot 基础简易实例, maven项目

    --------------------------- maven配置:pom.xml --------------------------- <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 ...

    SSM框架整合

    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0 <groupId>...

    t淘淘商城项目 商城项目 视频和源码教程 详细

    除了项目构建,Maven最核心的功能是软件包的依赖管理,能够自动分析项目所需要的依赖软件包,并到Maven中心仓库去下载。 A)管理依赖的jar包 B)管理工程之间的依赖关系。 3.2. Maven本地仓库 在当前系统用户的...

    java8看不到源码-dbflute.github.io:DBFlute官方网站

    pom.xml Internet connection 给 pom.xml 添加依赖: DBFlute: <dependency> <groupId>org.dbflute <artifactId>dbflute-runtime <!-- optional --> <!-- ${dbflute.version} --> </dependency> JDBC ...

    基于MyEclipse搭建maven+springmvc整合图文教程(含源码0

    使用Maven POM editor打开项目中的pom.xml文件,选择Dependencies,在Dependencies栏目点击Add进行,首先弹出一个搜索按钮,例如输入spring-web,就会自动搜索关于spring-web相关的jar包,我们选择3.0.5版本的spring...

    基于SpringBoot+Vue前后端分离的仓库管理系统后端源码+数据库+项目说明.zip

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...

    jul4nt:Java日志处理程序将日志记录发布到Windows事件日志

    您可以通过将库添加到pom.xml dependencies部分来开始使用该库: <!-- ... --> < dependency> < groupId>com.github.nikolaybespalov</ groupId> < artifactId>jul4nt ${jul4nt.version} < scope>...

    Maven2 的新特性.7z

    POM是Maven的核心对象模型,在Maven2中POM已由project.xml转移到pom.xml中使用,版本也由3升级为4。对于项目,一般只需要pom.xml就行了。 在Maven2中不需要也不提倡使用maven.xml,原因如下: • plugin的易用性的...

    hadoop mapreduce wordcount

    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0 <groupId>...

    logback-kafka-appender:适用于Apache Kafka的Logback附加程序

    logback-kafka-appender ...[maven pom.xml] < dependency> < groupId>com.github.danielwegener</ groupId> < artifactId>logback-kafka-appender < version>0.2.0 < scope>runtime</ scope> </ dependenc

    talkative-junit-tests:一个支持任意字符串作为测试名称的JUnit测试运行器

    健谈测试 安装 Maven Central当前不提供talkative-junit-tests。 (如果要我将其发布到Maven Central,请。... 在pom.xml和本自述文件的“ Installation部分中设置新版本。 提交修改后的pom.xml和README.md 。

Global site tag (gtag.js) - Google Analytics