既使用maven编译,又使用lib下的Jar包 https://my.oschina.net/u/2499632/blog/806047
按下面的方法写。
其中表示javac平时用空格隔开的的每一个参数。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <compilerArgs> <arg>-verbose</arg> <arg>-Xlint:unchecked</arg> <arg>-Xlint:deprecation</arg> <arg>-bootclasspath</arg> <arg>${env.JAVA_HOME}/jre/lib/rt.jar</arg> <arg>-extdirs</arg> <arg>${project.basedir}/src/main/webapp/WEB-INF/lib</arg> </compilerArgs> </configuration> </plugin> |
其中${project.basedir}一定要写,不然会出现“在windows”下可以正常编译,在Linux服务器上就“有可能”出现编译找不到jar包的错误。