由于项目需要的一个jar在maven仓库里没有,又不想把jar手动导入仓库。然而百度的几个处理方式都是一样的方法,我却没有一个成功的。于是就请教了大神,大神也是各种测试,终于成功实现了,实现如下:

新建文件夹,,与src同级,这里取名libs

dependency代码:
<dependency>
<groupId>org.wltea.ik-analyzer</groupId>
<artifactId>IKAnalyzer</artifactId>
<version>6.5.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/KAnalyzer-6.5.0.jar</systemPath>
</dependency>

plugin 编译代码:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<showWarnings>true</showWarnings>
<compilerArguments>
<extdirs>libs</extdirs>
</compilerArguments>
</configuration>
</plugin>

plugin打war包代码:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warName>${project.artifactId}</warName>
<webResources>
<resource>
<directory>${project.basedir}\libs\</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>KAnalyzer-6.5.0.jar</include>
<include>jave-1.0.2.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
05-11 22:55