maven项目打包 如何将本地文件打进war里 兼容性很好~
首先,找到你要导入的jar包的路径
我的在根目录的lib下
首先,需要在pom文件里面加入打包插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
<includeScope>system</includeScope>
</configuration>
</execution>
</executions>
</plugin>
在pom文件里面写入要导入的jar
注意格式要规范,不同插件格式不一样
<dependency>
<groupId>com.xxx</groupId>
<artifactId>xssprotest</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/xssProtect-0.1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.xxx</groupId>
<artifactId>qrcode</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/QRCode.jar</systemPath>
</dependency>