maven小技巧

1.在项目使用maven进行构建时,对于在本地上的jar包没有上传到maven库中,常用的办法是放到webapp/WEB-INF/lib目录下,但是在最后进行项目打包时就会报错,可以通过以下配置解决:
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.5.1</version>
    <configuration>
        <source>1.7</source>
	<target>1.7</target>
	<compilerArgument>-Xlint:all</compilerArgument>
	<showWarnings>true</showWarnings>
	<showDeprecation>true</showDeprecation>
	<compilerArguments>
            <extdirs>src\main\webapp\WEB-INF\lib</extdirs>
        </compilerArguments>
    </configuration>
</plugin>


2.对于某些不想进行打包的目录可以进行过滤,配置如下:
<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
	<warSourceExcludes>sql/**</warSourceExcludes>
    </configuration>
</plugin>

猜你喜欢

转载自nully.iteye.com/blog/2273471