`
- 浏览:
139762 次
- 性别:
- 来自:
广东广州
-
Maven-Maven Dependency Scope
-
compile
默认的scope,表示 dependency 都可以在生命周期中使用。而且,这些dependencies 会传递到依赖的项目中。
-
provided
跟compile相似,但是表明了dependency 由JDK或者容器提供,例如Servlet AP和一些Java EE APIs。这个scope 只能作用在编译和测试时,同时没有传递性。
-
runtime
表示dependency不作用在编译时,但会作用在运行和测试时
-
test
表示dependency作用在测试时,不作用在运行时。
-
system
跟provided 相似,但是在系统中要以外部JAR包的形式提供,maven不会在repository查找它。 例如:
<project>
...
<dependencies>
<dependency>
<groupId>javax.sql</groupId>
<artifactId>jdbc-stdext</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/rt.jar</systemPath>
</dependency>
</dependencies>
...
</project>
import (Maven 2.0.9 之后新增)
它只使用在<dependencyManagement>中,表示从其它的pom中导入dependency的配置,例如:
This scope is only used on a dependency of type pom in the <dependencyManagement> section. It indicates that the specified POM should be replaced with the dependencies in that POM's <dependencyManagement> section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
Dependency management - including transitive dependencies, scope recognition and SNAPSHOT handling Artifact deployment - deployment to a Maven repository (file integrated, other with extensions) POM ...
* [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] - ...
Dependency management - including transitive dependencies, scope recognition and SNAPSHOT handling Artifact deployment - deployment to a Maven repository (file integrated, other with extensions) POM ...
跑批项目打了jar包后,运行一直找不到主类或者找不到classpath下的依赖。 解决方法: ... <scope>runtime</scope> </dependencySet> <directory>src/main/bin <outputDirectory>/ </assembly>
<scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot <artifactId>spring-boot-starter-web </dependency> <dependency> <groupId>org.springframework.boot <artifactId>...
NULL 博文链接:https://dannyhz.iteye.com/blog/2249427
Maven项目管理工具,可以将一个完整的项目拆成一个一个模块进行开发,而一些比较通用的模块就可以作为公用组件。在其他项目中直接依赖使用,比如:公用的方法,权限组件等等。 一,新建一个简单的Maven工程,这个...
ojdbc6(此包解决mybatis_plus查询时分秒为0问题),springboot项目+oracle11g就用这个jdbc就行,放在项目的resources目录下... <scope>system</scope> ${pom.basedir}/src/main/resources/lib/ojdbc6.jar </dependency>
本教程是基于MyEclipse环境下基于maven搭建的springmvc步骤(图文教程),文章结尾含有源码下载地址: 新建maven project File->New->Project 选择Maven Project 选择项目路径 Use default Workspace location默认...
在POM 4中,<dependency>中还引入了<scope>,它主要管理依赖的部署。目前<scope>可以使用5个值: • compile,缺省值,适用于所有阶段,会随着项目一起发布。 • provided,类似compile,期望JDK、容器或使用者会...
<scope>test</scope> <groupId>org.junit.vintage <artifactId>junit-vintage-engine </dependency> <groupId>org.springframework.boot <artifactId>spring-boot-maven-...
): <dependency><groupId>com.github.neothemachine</groupId><artifactId>gwt-webdriver-junit-runstyle</artifactId><version>0.0.1-SNAPSHOT</version><scope>test</scope></dependency>调整gwt-maven-plugin...
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency>数据库: MYSQL(5.xx) ; NoSQL : Redis (并非用的很多);其他工具推荐谷歌...
Maven依赖管理 (Dependency Management) 3.5.6. 站点生成和报告 (Site Generation and Reporting) 3.6. 小结 4. 定制一个Maven项目 4.1. 介绍 4.1.1. 下载本章样例 4.2. 定义Simple Weather项目 4.2.1...
<scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok <artifactId>lombok <optional>true </dependency> <!--mybatisPlus--> <dependency>
<scope>provided</scope> </dependency> <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 --> <directory>src/main/java **/*.properties **/*.xml <filtering>false ...
除了项目构建,Maven最核心的功能是软件包的依赖管理,能够自动分析项目所需要的依赖软件包,并到Maven中心仓库去下载。 A)管理依赖的jar包 B)管理工程之间的依赖关系。 3.2. Maven本地仓库 在当前系统用户的...
<scope>test</scope> </dependency> <dependency> <groupId>javax.servlet <artifactId>javax.servlet-api <version>3.1.0 </dependency> <!-- mybatis依赖的jar包 --> <dependency> <groupId>org....
安装安装mvn软件包将依赖项添加到您的pom中: < dependency> < groupId>io.orangebeard</ groupId> < artifactId>junit4-listener</ artifactId> < version>version</ version> < scope>test</ scope></ dependency>...
<scope>system</scope> ${JAVA_HOME}/lib/tools.jar </dependency> <dependency> <groupId>junit <artifactId>junit <version>3.8.1 <scope>test</scope> </dependency> </project>