maven 之 插件收集 之一(helper, war, ant, compiler, *)
maven 之 插件收集 之一(helper, war, ant, compiler, *)
小骏骏 发表于5年前
maven 之 插件收集 之一(helper, war, ant, compiler, *)
  • 发表于 5年前
  • 阅读 1005
  • 收藏 6
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

摘要: helper, war, ant, compiler, surefire, site , javadoc, native2ascii

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
共有 人打赏支持
粉丝 9
博文 110
码字总数 22428
×
小骏骏
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: