Maven Exclude 源码编译,Maven Delete 本地Class

在源码编译期去掉某个java类的编译:

<plugin>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>3.3</version>
	<executions>
		<execution>
			<id>default-compile</id>
			<phase>compile</phase>
			<goals>
				<goal>compile</goal>
			</goals>
			<configuration >
				<source>1.6</source>
				<target>1.6</target>
				<encoding>utf-8</encoding>
                <excludes>
                    <exclude>com/xxxx/yyyy/zzzz/StoreTest.java</exclude>
                </excludes>
			</configuration>
		</execution>
	</executions>

</plugin>

 在编译完成之后,运行期并不依赖本地代码,或者其他jar或者应用容器本身提供相关(相当于maven中的provided,编译完就干掉)类:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-antrun-plugin</artifactId>
	<executions>
		<execution>
			<phase>process-classes</phase>
			<goals>
				<goal>run</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<tasks>
			<echo>Removing dummy classes</echo>
			<delete dir="target/classes/xxxx/yyyy/zzzz/impl" />
		</tasks>
	</configuration>
</plugin>

猜你喜欢

转载自takemind.iteye.com/blog/2347603