Maven学习9之声明周期自定义插件运行其他插件

来源:互联网 发布:google算法面试题 编辑:程序博客网 时间:2024/06/07 06:21


1.背景:被Adam系统package时,一般会生成多个module的class jar包,source jar包等,这些可以在build的里面管理


2. 可以在plugin后面插件下加入executions

phase是当执行这个的时候执行本插件,执行的goals是其中一个goal是jar-no-fork


<executions>              <execution>                <id>attach-sources</id>                <phase>package</phase>                <goals>                  <goal>jar-no-fork</goal>                </goals>              </execution>            </executions>



3.代码

 <profiles>    <profile>      <id>distribution</id>      <modules>        <module>adam-core</module>        <module>adam-apis</module>        <module>adam-cli</module>        <!-- distribution should be last -->        <module>distribution</module>      </modules>      <build>        <plugins>          <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-source-plugin</artifactId>            <version>2.4</version>            <executions>              <execution>                <id>attach-sources</id>                <phase>package</phase>                <goals>                  <goal>jar-no-fork</goal>                </goals>              </execution>            </executions>          </plugin>          <plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-javadoc-plugin</artifactId>            <version>2.10.3</version>            <executions>              <execution>                <id>attach-javadocs</id>                <phase>package</phase>                <goals>                  <goal>jar</goal>                </goals>              </execution>            </executions>          </plugin>          <plugin>



0 0