logo Apache Maven Invoker Plugin

The Maven Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project execution is successful, and optionally can verify the output generated from a given project execution.

homepage: maven.apache.org/plugins
fresh index:
last release: 11 months ago, first release: 2 decades ago
packaging: maven-plugin
get this artifact from: central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
invoker:help

Display help information on maven-invoker-plugin. Call mvn invoker:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

invoker:install (phase: pre-integration-test)

Installs the project artifacts of the main build into the local repository as a preparation to run the sub projects. More precisely, all artifacts of the project itself, all its locally reachable parent POMs and all its dependencies from the reactor will be installed to the local repository.

invoker:integration-test (phase: integration-test)

Searches for integration test Maven projects, and executes each, collecting a log in the project directory, will never fail the build, designed to be used in conjunction with the verify mojo.

invoker:report

Generate a report based on the results of the Maven invocations. Note: This mojo doesn't fork any lifecycle, if you have a clean working copy, you have to use a command like mvn clean integration-test site to ensure the build results are present when this goal is invoked.

invoker:run (phase: integration-test)

Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and outputting the results to the command line.

invoker:verify (phase: verify)

Checks the results of maven-invoker-plugin based integration tests and fails the build if any tests failed.

Often used code snippets:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-invoker-plugin</artifactId>
  <configuration>
    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
    <goals>
      <goal>test</goal>
      <goal>site</goal>
    </goals>
    <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
  </configuration>
  <executions>
    <execution>
      <id>integration-test</id>
      <goals>
        <goal>install</goal>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-invoker-plugin</artifactId>
  <version>3.1.0</version>
  <executions>
    <execution>
      <goals>
        <goal>install</goal>
        <goal>integration-test</goal>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <debug>true</debug>
    <ignoreFailures>false</ignoreFailures>
    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
    <projectsDirectory>src/it/projects</projectsDirectory>
    <settingsFile>src/it/mrm/settings.xml</settingsFile>
    <filterProperties>
      <ap.version>${project.version}</ap.version>
      <mrm.repository.url>${mrm.repository.url}</mrm.repository.url>
      <mrm.distribution.url>${mrm.distribution.url}</mrm.distribution.url>
      <avro.version>${avro.version}</avro.version>
      <spf4j.version>${spf4j.version}</spf4j.version>
    </filterProperties>
  </configuration>
</plugin>
<plugin>
  <artifactId>maven-invoker-plugin</artifactId>
  <version>1.6-SONATYPE-r940877</version>
  <configuration>
    <localRepositoryPath>${project.build.directory}/maven/fake-repo</localRepositoryPath>
    <extraArtifacts>
      <xml>org.apache.maven.plugins:maven-clean-plugin:2.2:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-compiler-plugin:2.0.2:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-dependency-plugin:2.0:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-deploy-plugin:2.3:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-deploy-plugin:2.4:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-deploy-plugin:2.5:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-install-plugin:2.2:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-jar-plugin:2.2:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-resources-plugin:2.2:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-resources-plugin:2.3:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-resources-plugin:2.4:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-surefire-plugin:2.4.2:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-surefire-plugin:2.4.3:maven-plugin</xml>
      <xml>org.apache.maven.plugins:maven-surefire-plugin:2.5:maven-plugin</xml>
    </extraArtifacts>
  </configuration>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>install</goal>
      </goals>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-invoker-plugin</artifactId>
  <version>3.2.0</version>
  <executions>
    <execution>
      <id>integration-test</id>
      <goals>
        <goal>install</goal>
        <goal>run</goal>
      </goals>
      <configuration>
        <showErrors>true</showErrors>
        <projectsDirectory>src/it</projectsDirectory>
        <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
        <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
        <settingsFile>src/it/settings.xml</settingsFile>
        <pomIncludes>
          <pomInclude>*/pom.xml</pomInclude>
        </pomIncludes>
        <goals>
          <goal>clean</goal>
          <goal>verify</goal>
        </goals>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-invoker-plugin</artifactId>
  <version>3.2.0</version>
  <executions>
    <execution>
      <id>integration-test</id>
      <goals>
        <goal>install</goal>
        <goal>run</goal>
      </goals>
      <configuration>
        <streamLogs>true</streamLogs>
        <projectsDirectory>src/it</projectsDirectory>
        <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
        <settingsFile>src/it/settings.xml</settingsFile>
        <profiles>it-repo</profiles>
        <showErrors>true</showErrors>
        <pomIncludes>
          <pomInclude>*/pom.xml</pomInclude>
        </pomIncludes>
        <goals>
          <goal>clean</goal>
          <goal>install</goal>
        </goals>
      </configuration>
    </execution>
  </executions>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.