Mojo Examples
2009-10-02

collect-files

Collects the LICENSE.txt file and store reference in target/collects.txt.

<plugin>
    <groupId>org.nuiton</groupId>
    <artifactId>helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>collect-files</id>
            <goals>
                <goal>collect-files</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
                <extraFiles>LICENSE.txt</extraFiles>
                <descriptionFile>target/collects.txt</descriptionFile>
            </configuration>
        </execution>

    </executions>
</plugin>

share-server-secret

Shares the secret of yourserverId says :

  • privateKey
  • password
  • username
  • passphrase
    <plugin>
        <groupId>org.nuiton</groupId>
        <artifactId>helper-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>share-server-secret</goal>
                </goals>
                <phase>validate</phase>
                <configuration>
                    <serverId>yourServerId</serverId>
                    <privateKeyOut>privateKey</privateKeyOut>
                    <passwordOut>password</passwordOut>
                    <usernameOut>username</usernameOut>
                    <passphraseOut>passphrase</passphraseOut>
                </configuration>
            </execution>
        </executions>
    </plugin>

send-email

Sends a email from noreply@noway.fr to receiver@noway.com.

the content of the email is in target/emailContent.txt.

<plugin>
    <groupId>org.nuiton</groupId>
    <artifactId>helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>send-email</goal>
            </goals>
            <phase>validate</phase>
        </execution>
    </executions>
    <configuration>
        <!-- for a multi-module just run on root project -->
        <runOnce>true</runOnce>

        <emailTitle>Title of email</emailTitle>
        <emailContentFile>target/emailContent.txt</emailContentFile>
        <mailSender>
            <email>noreply@noway.fr</email>
        </mailSender>
        <toAddresses>
            <item>receiver@noway.com</item>
        </toAddresses>
        <smtpHost>smtp</smtpHost>
    </configuration>
</plugin>

check-auto-container

To test if all depencies of a project are in maven central repository :

<plugin>
  <groupId>org.nuiton</groupId>
  <artifactId>helper-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>check-central-safe</id>
      <inherited>true</inherited>
      <goals>
        <goal>check-auto-container</goal>
      </goals>
      <phase>validate</phase>
      <configuration>
        <addMavenCentral>true</addMavenCentral>
      </configuration>
    </execution>
  </executions>
</plugin>

To test if all depencies of a project are in the repository :

  • id : nuiton-central-releases
  • url : http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases
    <plugin>
      <groupId>org.nuiton</groupId>
      <artifactId>helper-maven-plugin</artifactId>
      <executions>
        <execution>
          <id>check-central-safe</id>
          <inherited>true</inherited>
          <goals>
            <goal>check-auto-container</goal>
          </goals>
          <phase>validate</phase>
          <configuration>
            <repositories>
              <nuiton-central-releases>
                http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases
              </nuiton-central-releases>
            </repositories>
          </configuration>
        </execution>
      </executions>
    </plugin>

transform-project-version

Compute your project version 1.0 with a injected scm revision

<plugin>
  <groupId>org.nuiton</groupId>
  <artifactId>helper-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>transform-project-version</goal>
      </goals>
      <phase>validate</phase>
      <configuration>
         <revision>2</revision>
      </configuration>
    </execution>
  </executions>
</plugin>

The result 1.0-rev-2 will be stored in property newVersion.