Maven Central   mockserver

Maven Central contains the following released MockServer artifacts:

  • mockserver-netty - a web server for mocking and proxying using Netty, can be added to a maven build as follows:
    <dependency>
    	<groupId>org.mock-server</groupId>
    	<artifactId>mockserver-netty</artifactId>
    	<version>RELEASE</version>
    </dependency>
  • mockserver-netty:jar-with-dependencies - as above using Netty that includes all dependencies are bundled into the jar file, this artifact can be downloaded.
  • mockserver-war - a deployable WAR for mocking that can be deployed to any JEE web server, this artifact can be downloaded.
  • mockserver-proxy-war - a deployable WAR for proxying that can be deployed to any JEE web server, this artifact can be downloaded.
  • mockserver-maven-plugin - a set of maven plugins to start, stop and fork MockServer using maven, can be added to a maven build as follows:
    <plugin>
        <groupId>org.mock-server</groupId>
        <artifactId>mockserver-maven-plugin</artifactId>
        <version>RELEASE</version>
        <configuration>
            <serverPort>1080</serverPort>
            <pipeLogToConsole>true</pipeLogToConsole>
    </plugin>
  • mockserver-client-java - a Java client to communicate with both the server and the proxy, can be added to a maven build as follows:
    <dependency>
    	<groupId>org.mock-server</groupId>
    	<artifactId>mockserver-client-java</artifactId>
    	<version>RELEASE</version>
    </dependency>
 

Sonatype SNAPSHOT

The continuous integration build on Travis CI deploys a SNAPSHOT version on every github commit these SNAPSHOT artifacts can be found at Sonatype

To use the SNAPSHOT version you need to configure your maven settings.xml or your pom.xml to include the Sonatype SNAPSHOT repository as follows:

<profile>
    <id>sonatype</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <repositories>
        <repository>
            <id>sonatype-nexus-snapshots</id>
            <name>sonatype-nexus-snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>sonatype-nexus-snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</profile>

Note: typically it is best practice to configure the ~/.m2/settings.xml file instead of the settings.xml file located inside the conf directory in the maven installation directory (i.e. $M2_HOME). This is because the ~/.m2/settings.xml file will be consistent between maven version upgrades and any changes to this file will only affect a single user.

Once the Sonatype SNAPSHOT repository has been added, as above, the latest SNAPSHOT build can referenced.

For example add a dependency on the latest SNAPSHOT build for mockserver-netty, as follows:

<dependency>
	<groupId>org.mock-server</groupId>
	<artifactId>mockserver-netty</artifactId>
	<version>SNAPSHOT</version>
</dependency>