
2、然后我们在maven的pom.xml中配置
[html] view plain copy
<groupId>org.wltea.analyzer</groupId>
<artifactId>IKAnalyzer</artifactId>
<version>2012FF_u1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/IKAnalyzer2012FF_u1.jar
</systemPath>
3、这里的groupId和artifactId以及version都是可以随便填写的 ,scope必须填写为system,而systemPath我们现在我们jar包的地址就可以了
4、最后我们必须在maven打包的过程中加入我们这个jar包。因为项目运行的时候需要这个Jar,并且我们得拷贝在WEB-INF/lib目录下
[html] view plain copy
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${project.basedir}/lib</directory>
<targetPath>WEB-INF/lib</targetPath>
<filtering>false</filtering>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
<version>2.1.1</version>
maven添加本地jar包很简单。只需要将jar包在本地所在的路径加到pom.xml的dependences中即可。配置如下:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>1.1.1</version>
<scope>system</scope>
<!--本地jar的路径,相对或者绝对都可以-->
<systemPath>path/to/yourLocalJar.jar</systemPath>
</dependency>
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)