标签:-- project oal gdi 生命周期 package 1.0 miss conf
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<!--在构建生命周期中执行一组目标的配置。每个目标可能有不同的配置。-->
<executions>
<execution><!--execution元素包含了插件执行需要的信息-->
<id>create-missingpost-treatment</id><!--执行目标的标识符,用于标识构建过程中的目标,或者匹配继承过程中需要合并的执行目标-->
<phase>prepare-package</phase><!--绑定了目标的构建生命周期阶段,如果省略,目标会被绑定到源数据里配置的默认阶段-->
<goals>
<goal>execute</goal><!--执行目标,通常由jar,excute-->
</goals>
<inherited/><!--配置是否被传播到子POM-->
<configuration><!--作为DOM对象的配置-->
<source><![CDATA[
def confDir = new File(project.build.directory, "conf")
def treatmentFile = new File(confDir, project.artifactId+"/PostTreatment.groovy")
if(confDir.exists() && !treatmentFile.exists()){
treatmentFile.parentFile.mkdirs()
treatmentFile << """
class PostTreatment {
def run(def project, def log, def ant, def basedirFile, def configDir,
def target, def subTarget, def targetDir) {
log.info("No post treatment required for this project")
}
}
"""
}
]]></source>
</configuration>
</execution>
<execution>
<id>post-treatment-script</id>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<scriptpath>
<element>${project.build.directory}/conf/${project.artifactId}</element>
<element>${project.build.directory}/conf/scripts</element>
</scriptpath>
<source>${postTreatmentScript}</source>
</configuration>
</execution>
</executions>
</plugin>
标签:-- project oal gdi 生命周期 package 1.0 miss conf
原文地址:https://www.cnblogs.com/lhs-2-xx/p/9657014.html