在一个maven项目中,如果存在编译需要而发布不需要的jar包,可以用scope标签,值设为provided。如下:
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
<classifier />
</dependency>
scope的其他参数如下:
-
compile
默认的scope,表示 dependency 都可以在生命周期中使用。而且,这些dependencies 会传递到依赖的项目中。适用于所有阶段,会随着项目一起发布 -
provided
跟compile相似,但是表明了dependency 由JDK或者容器提供,例如Servlet AP和一些Java EE APIs。这个scope 只能作用在编译和测试时,同时没有传递性。???????? -
runtime
表示dependency不作用在编译时,但会作用在运行和测试时,如JDBC驱动,适用运行和测试阶段。 -
test
表示dependency作用在测试时,不作用在运行时。 只在测试时使用,用于编译和运行测试代码。不会随项目发布。 -
system
跟provided 相似,但是在系统中要以外部JAR包的形式提供,maven不会在repository查找它。
http://blog.csdn.net/daihui05/article/details/7476976
相关推荐
在其他项目中直接依赖使用,比如:公用的方法,权限组件等等。 一,新建一个简单的Maven工程,这个Maven工程只含一个pom文件,他是管理各个模块的父级POM,如: Xml代码 <packaging>pom</packaging> <modules> ...
为了使用该项目,请在 pom.xml 中包含以下依赖项: < groupId>com.github.davidrabinowitz.unittesting</ groupId> < artifactId>unit-testing < version>0.1-SNAPSHOT < scope>test</ scope> </ dependency>
用法添加 maven 依赖项(尚未在 Maven Central 上!): <dependency><groupId>com.github.neothemachine</groupId><artifactId>gwt-webdriver-junit-runstyle</artifactId><version>0.0.1-SNAPSHOT</version><scope...
Stackify Logback记录器 ...将其添加为Maven依赖项: < groupId>com.stackify</ groupId> < artifactId>stackify-log-logback < version>4.0.1 < scope>runtime</ scope> 用法 附加程序配置示例: < a
考试题库 hamcrest库Matcher库的简单示例 安装(Maven) 最新版本1,3:2012年7月 <groupId>org.hamcrest <artifactId>hamcrest-all <scope>test</scope> <version>1.3 ...Maven依赖 <groupId>com
将其添加为Maven依赖项: < groupId>com.stackify</ groupId> < artifactId>stackify-log-log4j2 < version>4.0.1 < scope>runtime</ scope> 用法 配置示例: < StackifyLog name =
: 安装将其添加为Maven依赖项: < dependency> < groupId>com.stackify</ groupId> < artifactId>stackify-log-log4j12</ artifactId> < version>4.0.1</ version> < scope>runtime</ scope>用法附加程序...
找到兼容版本的最简单方法是依赖我们随定义的兼容版本提供的Spring Data Release Train BOM。在Maven项目中,您将在<dependencyManagement />POM 的部分中声明此依赖项,如下所示: 示例1.使用Spring Data版本系列...
使用方法 ♡maven的相关依赖,注意范围只需要写test就可以了 < groupId>com.github.davidfantasy</ groupId> < artifactId>mybatis-plus-generator-ui < version>1.4.2 < scope>test</ scope> 在项目的test...
将依赖项添加到您的 Maven POM: < groupId>com.bytebybyte.gwt</ groupId> < artifactId>jquery-lib < version>2.1.3 < scope>provided</ scope> < groupId>com.bytebybyte.gwt</ groupId> < artifactId>...
将依赖项添加到您的 Maven POM: < groupId>com.bytebybyte.gwt</ groupId> < artifactId>jquery-lib < version>2.1.3 < scope>provided</ scope> < groupId>com.bytebybyte.gwt</ groupId> < artifactId>...
其余依赖项在maven依赖项中声明。 基本用法 final AbstractIdentifierRenamings renamer = new BaseIdentifierRenamings ( new JavaTokenizer ()); renamer . buildRenamingModel(trainingFiles); final ...
在您的项目中使用以下依赖项: <groupId>com.checkmate.sdk</groupId> <artifactId>checkmate-java-sdk <version>1.0.0 <scope>compile</scope> 如果你想自己编译它,方法如下: $ git clone git@github....
java笔试题算法福尔瑟姆 Folsom 是一个小而稳定的内存缓存客户端的尝试。 Folsom 是完全异步的,基于 Netty,并在整个 ...<scope>import</scope> <!-- In dependencies section --> <gro
好消息,mongodb 现在提供了一个 rx 驱动: : 这个项目现在已经死了,请使用 mongo-java-driver-rx mongo-driver-async-rxadapter 用于 Mongo 3 异步驱动程序的 RxJava 适配器 用法 new RxMongoClient(mongoClient...
在您的项目中使用以下依赖项: <groupId>com.bandwidth.sdk</groupId> <artifactId>bandwidth-java-iris-sdk <version>1.0 <scope>compile</scope> 如果你想自己编译它,方法如下: $ git clone git@github....
将jUnit4和selenium2-visualdiff核心库作为依赖项嵌入到您的功能测试 maven 模块中: ... <groupId>org.kreyssel.selenium2.visualdiff <artifactId>visualdiff-core <version>1.0.0-SNAPSHOT <scope>test...
要使用Maven在此库上添加依赖项,请使用以下命令: < groupId>com.increff.commons</ groupId> < artifactId>increff-commons-lang < version>1.0.1 < scope>test</ scope> 关键课程 收集实用程序 C
首先,您将添加依赖项: <dependency> <groupId>de.egore911.appframework</groupId> <artifactId>appframework-testing</artifactId> <version>1.0.6</version> <scope>test</scope>您还可以将该部分添加到pom.xml...
使用容器发布事件 Spring高级话题 Spring Aware BeanNameAware BeanFactoryAware ApplicationContextAware MessageSourceAware ApplicationEventPublisherAware ResourceLoaderAware 多...