Maven: Let mvn-Pjenkins be the same as mvn clean install pmd: pmd javadoc: aggregate

We have several Maven jobs in our Jenkins instance, each of which has its own call string specified in an assembly configuration similar to

mvn clean install -DDISABLED="javadoc:aggregate" checkstyle:checkstyle pmd:pmd findbugs:findbugs

I would like to combine this so that the call line is stored somewhere in the POM along with the appropriate profile information, so that we can replace the call lines of all these slightly different tasks with

mvn -Pjenkins

standard call. As far as I understand, a record defaultGoalsupports only one goal, which at first glance seems insufficient to represent our multiple goals, but may be enough if we can make it more suitable for several records. If at all possible, I would like to avoid setting up specific bindings to the standard stages of the life cycle if a simple call line is executed.

+5
source share
3 answers

You can configure additional mojos ina profile, and you can bind mojos to the stages of the life cycle. These two things combined will allow you to launch additional mojos when a specific profile is set.

, Maven. , "mvn release: ", Maven "-Prelease", , GPG.

<profile>
  <id>jenkins</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>findbugs</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      ... other mojos ...

mojo , . mojo, - , <phase> ... </phase> .

. POM Jenkins , FindBugs. mojos .

, (, ).

+4

, Maven . , "jenkins", checkstyle, pmd findbugs (, ). mvn -Pjenkins clean install. , (, PMD).

+2

, checkstyle, pmd, findbugs javadoc- <build><plugins/></build> <properties>, javadoc. maven-clean-plugin, clean. :

mvn -Pjenkins site:site

defaultGoal site, .

0

All Articles