导入
一个 Jar 包
<dependency> <groupId>local</groupId> <artifactId>aliyun-java-sdk-core</artifactId> <version>3.3.1</version> <scope>system</scope> <systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/aliyun-java-sdk-core-3.3.1.jar</systemPath> </dependency>
多个 Jar 包,配置 maven-compiler-plugin 插件
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <compilerArgs> <arg>-extdirs</arg> <arg>${project.basedir}/src/main/webapp/WEB-INF/lib</arg> </compilerArgs> </configuration> </plugin>
打包
war 包
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <directory>${project.basedir}/src/main/resources/lib/</directory> <targetPath>WEB-INF/lib</targetPath> <includes> <include>**/*.jar</include> </includes> </resource> </webResources> </configuration> </plugin>
jar 包
<resources> <resource> <directory>${project.basedir}/src/main/resources/lib/</directory> <targetPath>BOOT-INF/lib/</targetPath> <includes> <include>**/*.jar</include> </includes> </resource> </resources>
https://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html