Maven-10Pom中插件任務配置

 Pom中插件任務配置

 

<build>
	<plugins>
		<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-antrun-plugin</artifactId>
		<version>1.3</version>
		<executions>
			<execution>
				<id>ant-validate</id>
				<phase>validate</phase>
				<goals>
					<goal>run</goal>
				</goals>
				<configuration>
					<tasks>
						<echo>I'm bound to validate phase.</echo>
					</tasks>
				</configuration>
			</execution>
			<execution>
				<id>ant-verify</id>
				<phase>verify</phase>
				<goals>
					<goal>run</goal>
				</goals>
				<configuration>
					<tasks>
						<echo>I'm bound to verify phase.</echo>
					</tasks>
				</configuration>
			</execution>
		</executions>
		</plugin>
	</plugins>
</build>

在上述代碼中,首先,mvaen-antrun-plugin:run與validate階段綁定,從而構成一個id爲ant-validate的任務。插件全局配置中的configuration元素位於plugin元素下面,而這裏的configuration元素則位於execution元素下面,表示這是特定任務的配置,而非插件整體的配置。這個ant-validate任務配置了一個echo Act任務,向命令行輸出一段文字,表示該任務是綁定到validate階段的。第二個任務的id爲ant-varify,它綁定到了verify階段,同樣它也輸出一段文字到命令行,告訴我們任務綁定到了verify階段。
發佈了55 篇原創文章 · 獲贊 14 · 訪問量 17萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章