Fork me on GitHub

Usage

The plugin offers goals for hosting a mock repository manager as part of a Maven project lifecycle.

Basic Usage

Before you start it is best to add mrm-maven-plugin as a plugin in your pom.

<project>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>mrm-maven-plugin</artifactId>
        <version>2.0.0</version>
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>

Security

By default the Mock Repository Manager is not secured, meaning that every for every http call you don't need to be authorized or even authenticated. Every existing resource will be served.

By adding users to the configuration of the plugin annotation, every http call must contain a basic authorization header to access the resources.

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>mrm-maven-plugin</artifactId>
    <version>2.0.0</version>
    <configuration>
      ...
      <users>
        <user>
          <username>john.doe</username>
          <password>s3cr3t</password>
        </user>
      </users>
    </configuration>
  </plugin>

Start up a test Mock Repository Manager

To start up a test Mock Repository Manager to allow you to develop your tests using your favorite IDE, invoke the run goal.

mvn mrm:run

You can change the port that the mock repository manager binds to either using the mrm.port property from the command line, e.g.

mvn mrm:run -Dmrm.port=8080

Or in the configuration block in the plugin definition (which has the advantage that all invocations will use the same parameters).

<project>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>mrm-maven-plugin</artifactId>
        <version>2.0.0</version>
        <configuration>
          <port>8080</port>
        </configuration>
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>