打maven包及引入本地jar包

[size=large]在maven开发中,一般情况下需要从maven仓库中下载jar包,仅需要在pom.xml文件中进行配置即可,但某些情况下,maven仓库不由自己管理,没有包含需要用到的jar包,此时就需要在项目中自己引入jar包。步骤如下:
1、在根目录下新建一个文件夹;
2、在pom文件中对项目文件进行绝对引用;

举例如下:
比如需要在项目中引入struts单元测试相关包,可以在maven中进行如下配置:[/size]
<!-- 单元测试专用 -->
<dependency>
<groupId>cn.mamp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${basedir}/junitlib/jsp-api-2.0.jar</systemPath>
</dependency>
<dependency>
<groupId>cn.mamp</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.5</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${basedir}/junitlib/spring-test-3.0.5.RELEASE.jar</systemPath>
</dependency>
<dependency>
<groupId>cn.mamp</groupId>
<artifactId>struts2-junit</artifactId>
<version>2.3.32</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${basedir}/junitlib/struts2-junit-plugin-2.3.32.jar</systemPath>
</dependency>
<!-- 单元测试专用 -->


[size=large]maven内置变量说明:[/size]
[color=red][size=large][list]
[*]${basedir} 项目根目录
[*]${project.build.directory} 构建目录,缺省为target
[*]${project.build.outputDirectory} 构建过程输出目录,缺省为target/classes
[*]${project.build.finalName} 产出物名称,缺省为${project.artifactId}-${project.version}
[*]${project.packaging} 打包类型,缺省为jar
[*]${project.xxx} 当前pom文件的任意节点的内容
[/list][/size][/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值