maven 之 插件收集 之一

1. 定义java 源代码目录 

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>1.5</version>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>mule/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin> 

2. 生成war 包 

		<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
						</manifest>
					</archive>
					<webResources>
						<resource>
							<directory>${additionalWebappFolderName}</directory>
						</resource>
					</webResources>
				</configuration>
			</plugin>

3. 运行ant 的插件

<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<configuration>
							<tasks>
								<ant antfile="support/doclet-build.xml" target="${antrun.target}">
									<property name="runtargets" value="${target}" />
								</ant>
							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

4. 编译java 代码的插件

<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${compile.source}</source>
					<target>${compile.target}</target>
					<encoding>${encoding.source}</encoding>
				</configuration>
			</plugin>

5. 运行 TestCase 的插件

<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<includes>
						<include>**/*Test.java</include>
					</includes>
					<excludes>
						<exclude>**/dao/**/*Test.java</exclude>
					</excludes>
					<skip>true</skip>
					<testFailureIgnore>false</testFailureIgnore>
				</configuration>
				<executions>
					<execution>
						<!-- For dao, "forkMode=pertest" is needed to create schema for every 
							dao test -->
						<id>only_dao</id>
						<phase>test</phase>
						<goals>
							<goal>test</goal>
						</goals>
						<configuration>
							<includes>
								<include>**/dao/**/*Test.java</include>
							</includes>
							<excludes>
								<exclude>none</exclude>
							</excludes>
							<forkMode>pertest</forkMode>
						</configuration>
					</execution>
				</executions>
			</plugin>

6. 定义系统语言的插件

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-site-plugin</artifactId>
				<configuration>
					<locales>ja,en</locales>
					<inputEncoding>${encoding.source}</inputEncoding>
					<outputEncoding>${encoding.output}</outputEncoding>
				</configuration>
			</plugin>

7. 生成javadoc 的插件

<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<charset>${encoding.output}</charset>
					<encoding>${encoding.source}</encoding>
					<docencoding>${encoding.output}</docencoding>
					<linksource>true</linksource>
					<show>private</show>
				</configuration>
			</plugin>

8.  将properties 进行编码插件

<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>native2ascii-maven-plugin</artifactId>
				<configuration>
					<src>${basedir}/src/main/resources</src>
					<dest>${project.build.outputDirectory}</dest>
					<includes>
						<include>*.properties</include>
					</includes>
					<encoding>${encoding.source}</encoding>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>native2ascii</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

你可能感兴趣的:(maven,plugin)