标签:
1、首先我在项目根目录中创建一个lib文件夹,将jar包拷贝到lib文件夹下
2、然后我们在maven的pom.xml中配置
<groupId>org.wltea.analyzer</groupId> <artifactId>IKAnalyzer</artifactId> <version>2012FF_u1</version> <scope>system</scope> <systemPath>${project.basedir}/lib/IKAnalyzer2012FF_u1.jar </systemPath>
<!-- npl本地so --> <dependency> <groupId>com.netease.npl</groupId> <artifactId>npl</artifactId> <version>0.0.1</version> <scope>system</scope> <systemPath>${project.basedir}/lib/QASystem.jar </systemPath> </dependency> <dependency> <groupId>edu.stanford.nlp</groupId> <artifactId>nlp</artifactId> <version>3.5.2</version> <scope>system</scope> <systemPath>${project.basedir}/lib/stanford-segmenter-3.5.2.jar </systemPath> </dependency>
3、这里的groupId和artifactId以及version都是可以随便填写的 ,scope必须填写为system,而systemPath我们现在我们jar包的地址就可以了
4、最后我们必须在maven打包的过程中加入我们这个jar包。因为项目运行的时候需要这个Jar,并且我们得拷贝在WEB-INF/lib目录下
<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>
<!-- 加载本地jar包 --> <plugin> <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>
标签:
原文地址:http://www.cnblogs.com/Weagle/p/5358480.html