以oracle为例:
第一步:引入jar包,${basedir}是系统参数
<!-- oracle驱动包 --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>12.1.0.1-atlassian-hosted</version> <scope>system</scope> <systemPath>${basedir}/lib/ojdbc6-12.1.0.1-atlassian-hosted.jar</systemPath> </dependency>
第二步:在<plugins>标签下添加以下配置
<!--设置maven-war-plugins插件,否则外部依赖无法打进war包--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <directory>lib</directory> <targetPath>WEB-INF/lib/</targetPath> <includes> <include>**/*.jar</include> </includes> </resource> </webResources> </configuration> </plugin>
第三步:执行打包命令mvn clean package