Using with Maven Invoker and Distribution Management
When we want to test the distribution of artifacts, we'll have to add a separate execution block: one which is used for the repositories (read, see Using with Maven Invoker and repositories) and a second one which is used for distribution management (write).
<project> ... <build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-invoker-plugin</artifactId> <version>2.0.0</version> <executions> <execution> <goals> <goal>install</goal> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> <configuration> <filterProperties> <mrm.distribution.url>${mrm.distribution.url}</mrm.distribution.url> </filterProperties> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>mrm-maven-plugin</artifactId> <version>1.4.1</version> <executions> ... <execution> <id>distribution</id> <goals> <goal>start</goal> <goal>stop</goal> </goals> <configuration> <propertyName>mrm.distribution.url</propertyName> <repositories> <hostedRepo> <target>target/hosted-repo</target> </hostedRepo> </repositories> </configuration> </execution> </executions> </plugin> ... </plugins> ... </build> ... </project>
Next you need to ensure per pom.xml
that the value of mrm.distribution.url
is used for the distribution management.
<?xml version="1.0" encoding="UTF-8"?> <project> ... <distributionManagement> <repository> <id>mrm</id> <url>${mrm.distribution.url}</url> </repository> <snapshotRepository> <id>mrm</id> <url>${mrm.distribution.url}</url> </snapshotRepository> </distributionManagement> ... </project>
If you want to split the snapshotRepository from the (release) repository, you have to add an extra execution-block with a different propertyName.
Since you've defined target/hosted-repo
as the upload directory, you can use the postbuild-script from the maven-invoker-plugin to verify if all artifacts were uploaded as expected.