maven依赖非maven库中jar的两种方法

时间:2023-03-08 22:25:40

1.利用

maven-compiler-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<encoding>${maven.compiler.encoding}</encoding>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<extdirs>src\main\webapp\WEB-INF\lib</extdirs>
</compilerArguments>
</configuration>
<executions>
<execution>
<phase>compile</phase>
</execution>
</executions>
</plugin>

2.利用

dependency
(本人未测试)
<dependency>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/xx.jar</systemPath>
</dependency>