Skip to content

Commit

Permalink
Migrate documentation to Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmoniuk authored and slawekjaranowski committed Jan 17, 2023
1 parent 4d4037e commit fa8c6a4
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 286 deletions.
71 changes: 0 additions & 71 deletions mrm-maven-plugin/src/site/apt/index.apt

This file was deleted.

94 changes: 0 additions & 94 deletions mrm-maven-plugin/src/site/apt/usage.apt.vm

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
~~
~~ Licensed under the Apache License, Version 2.0 (the "License");
~~ you may not use this file except in compliance with the License.
~~ You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing, software
~~ distributed under the License is distributed on an "AS IS" BASIS,
~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~~ See the License for the specific language governing permissions and
~~ limitations under the License.
~~
title: Using with Maven Invoker with distribution management
author: Robert Scholte
date: 2017-03-20

------
Using with Maven Invoker with distribution management
------
Robert Scholte
------
2017-03-20
------
<!---
Copyright 2011 Stephen Connolly

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

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](./invoker-tests.html))
and a second one which is used for distribution management (write).

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 {{{./invoker-tests.html}Using with Maven Invoker and repositories}})
and a second one which is used for distribution management (write).

---
```xml
<project>
...
<build>
Expand Down Expand Up @@ -81,11 +80,11 @@ Using with Maven Invoker and Distribution Management
</build>
...
</project>
---
```

Next you need to ensure per <<<pom.xml>>> that the value of <<<mrm.distribution.url>>> is used for the distribution management.
Next you need to ensure per `pom.xml` that the value of `mrm.distribution.url` is used for the distribution management.

---
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
...
Expand All @@ -101,9 +100,9 @@ Using with Maven Invoker and Distribution Management
</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.
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.
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.

Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
~~
~~ Copyright 2011 Stephen Connolly
~~
~~ Licensed under the Apache License, Version 2.0 (the "License");
~~ you may not use this file except in compliance with the License.
~~ You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing, software
~~ distributed under the License is distributed on an "AS IS" BASIS,
~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~~ See the License for the specific language governing permissions and
~~ limitations under the License.
~~

------
Using with Maven Invoker
------
Stephen Connolly
------
2013-02-23
------
title: Using with Maven Invoker
author: Stephen Connolly
date: 2013-02-23

<!---
Copyright 2011 Stephen Connolly

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

Using with Maven Invoker and Repositories
=========================================

The aim here is to combine the usage of the <<<mrm-maven-plugin>>> with the <<<maven-invoker-plugin>>> to
allow the integration tests of a Maven Plugin to be run against a test local repository thereby ensuring that
the plugin does not get installed into the local repository until after the integration tests have been confirmed
as passing.
The aim here is to combine the usage of the `mrm-maven-plugin` with the `maven-invoker-plugin` to
allow the integration tests of a Maven Plugin to be run against a test local repository thereby ensuring that
the plugin does not get installed into the local repository until after the integration tests have been confirmed
as passing.

First we need to modify the <<<pom.xml>>> to reference both <<<mrm-maven-plugin>>> and the
<<<maven-invoker-plugin>>>
First we need to modify the `pom.xml` to reference both `mrm-maven-plugin` and the
`maven-invoker-plugin`

---
```xml
<project>
...
<build>
Expand Down Expand Up @@ -101,46 +98,35 @@ Using with Maven Invoker and Repositories
</build>
...
</project>
---

This will result in the following mojos being executed during the lifecycle as follows:

*-----------------------+---------------------------------+
| <<Phase>> | <<Goal(s)>> |
*-----------------------+---------------------------------+
| pre-integration-test | mrm:start, invoker:install |
*-----------------------+---------------------------------+
| integration-test | invoker:integration-test |
*-----------------------+---------------------------------+
| post-integration-test | mrm:stop |
*-----------------------+---------------------------------+
| verify | invoker:verify |
*-----------------------+---------------------------------+

Additionally, when <<<mrm:start>>> is invoked, it will bind to an available port and set the property
<<<repository.proxy.url>>> to the URL on which the repository is being hosted, and the repository content
will be based on the <<<mockRepo>>> content generated from the following files in <<<src/it/mrm/repository>>>:

* <<<**/*.pom>>>

* <<<**/*-\{classifier\}.{type}>>> as file, which will use the GAV of the corresponding <<<pom>>> -file (e.g. <<<mojo-parent-10.pom>>> with <<<mojo-parent-10-site.xml>>> )
```

* <<<**/*.jar>>> as directory, which will use the GAV of the corresponding <<<pom>>> -file. MRM will create an archive of this directory.
This will result in the following mojos being executed during the lifecycle as follows:

* <<<**/*-\{classifier\}.jar>>> as directory, which will use the GAV of the corresponding <<<pom>>> -file. MRM will create an archive of this directory.
| _Phase_ | _Goal(s)_ |
|-----------------------|----------------------------|
| pre-integration-test | mrm:start, invoker:install |
| integration-test | invoker:integration-test |
| post-integration-test | mrm:stop |
| verify | invoker:verify |

* <<<archetype-catalog.xml>>>
Additionally, when `mrm:start` is invoked, it will bind to an available port and set the property
`repository.proxy.url` to the URL on which the repository is being hosted, and the repository content
will be based on the `mockRepo` content generated from the following files in `src/it/mrm/repository`:

[]
* `**/*.pom`
* `**/*-\{classifier\}.{type}` as file, which will use the GAV of the corresponding `pom` -file (e.g. `mojo-parent-10.pom` with `mojo-parent-10-site.xml` )
* `**/*.jar` as directory, which will use the GAV of the corresponding `pom` -file. MRM will create an archive of this directory.
* `**/*-\{classifier\}.jar` as directory, which will use the GAV of the corresponding `pom` -file. MRM will create an archive of this directory.
* `archetype-catalog.xml`

In additional content install by <<<maven-invoker-plugin:install>>> will be available by <<localRepo>>
In additional content install by `maven-invoker-plugin:install` will be available by _localRepo_

Finally thanks to <<<proxyRepo>>>, all the repositories available to the current Maven instance will be available too.
Finally thanks to `proxyRepo`, all the repositories available to the current Maven instance will be available too.

We tell <<<maven-invoker-plugin>>> to use the <<<settings.xml>>> file from <<<src/it/mrm/settings.xml>>>
which will look something like:
We tell `maven-invoker-plugin` to use the `settings.xml` file from `src/it/mrm/settings.xml`
which will look something like:

---
```xml
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
Expand Down Expand Up @@ -193,7 +179,7 @@ Using with Maven Invoker and Repositories
</activeProfiles>

</settings>
---
```

And we also have instructed the <<<maven-invoker-plugin>>> to filter in the property value <<<repository.proxy.url>>>
Thus when the integration tests run, they will use the mock repository manager that we have provisioned.
And we also have instructed the `maven-invoker-plugin` to filter in the property value `repository.proxy.url`
Thus when the integration tests run, they will use the mock repository manager that we have provisioned.
Loading

0 comments on commit fa8c6a4

Please sign in to comment.