背景 最新项目引入了对接其他项目,但是其他项目提供的jar不是mvn的,所以每次mvn编译都是失败 解决方式将非Maven的jar通过下面方式定义的项目的pmo文件- <dependency>
- <groupId>cn.xxx</groupId>
- <artifactId>xxx</artifactId>
- <version>2.0</version>
- <scope>system</scope>
- <systemPath>${project.basedir}/lib/xxx.jar</systemPath>
- </dependency>
复制代码说明: systemPath:jar包的路径 修改maven的编译插件:
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <warName>${project.artifactId}</warName>
- <webResources>
- <resource>
- <directory>lib/</directory>
- <targetPath>WEB-INF/lib</targetPath>
- <includes>
- <include>**/*.jar</include>
- </includes>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.2</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <encoding>utf-8</encoding>
- <debug>true</debug>
- <fork>true</fork>
- <compilerArguments>
- <extdirs>src\main\webapp\WEB-INF\lib</extdirs>
- </compilerArguments>
- </configuration>
- </plugin>
复制代码
|