Skip to content

Commit a50c102

Browse files
committed
snapshot support
refactored invoker tests
1 parent 7545f37 commit a50c102

78 files changed

Lines changed: 1164 additions & 1433 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,41 @@ for details on making your build reproducible.
1818

1919
## Goals
2020

21-
There are two goals: [local](https://chonton.github.io/exists-maven-plugin/0.6.0/local-mojo.html)
21+
There are two goals: [local](https://chonton.github.io/exists-maven-plugin/0.7.0/local-mojo.html)
2222
checks if the just built artifact is already in the local repository;
23-
and [remote](https://chonton.github.io/exists-maven-plugin/0.6.0/remote-mojo.html) checks if the
23+
and [remote](https://chonton.github.io/exists-maven-plugin/0.7.0/remote-mojo.html) checks if the
2424
just built artifact is already in the remote repository.
2525

26-
Mojo details at [plugin info](https://chonton.github.io/exists-maven-plugin/0.6.0/plugin-info.html)
26+
Mojo details at [plugin info](https://chonton.github.io/exists-maven-plugin/0.7.0/plugin-info.html)
2727

2828
## Parameters
2929

3030
Every parameter can be set with a maven property **exists.**_<parameter_name\>_. e.g. skip parameter
31-
can be set from command line -Dexists.skip=true
32-
33-
| Parameter | Default | Description |
34-
|--------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------|
35-
| artifact | ${project.artifactId}-${project.version}.{packaging} | The artifact within the project to query |
36-
| cmpChecksum | false | Compare checksums of artifacts |
37-
| failIfExists | false | Fail the build if the artifact already exists |
38-
| failIfNotExists | false | Fail the build if the artifact does not exist |
39-
| failIfNotMatch | false | Fail the build if the artifact exists and cmpChecksum is set and checksums do not match |
40-
| project | ${project.groupId}:${project.artifactId}:${project.version} | The project within the repository to query |
41-
| property | ${maven.deploy.skip} _or_ ${maven.install.skip} | The property to receive the result of the query |
42-
| repository | ${project.distributionManagement.repository.url} | For remote goal, the repository to query for artifacts |
43-
| requireGoal | | Execute goal only if requireGoal value matches one of the maven command line goals |
44-
| serverId | ${project.distributionManagement.repository.id} | For remote goal, the server ID to use for authentication and proxy settings |
45-
| skip | false | Skip executing the plugin |
46-
| skipIfSnapshot | true | Skip the query if the project ends with -SNAPSHOT |
47-
| snapshotRepository | ${project.distributionManagement.snapshotRepository.url} | For remote goal, the repository to query for snapshot artifacts |
48-
| snapshotServerId | ${project.distributionManagement.snapshotRepository.id} | For remote goal, the server ID to use for snapshot authentication and proxy settings |
49-
| userProperty | false | If the property should be set as a user property, to be available in child projects |
31+
can be set from command line -Dexists.skip=true.
32+
33+
In the following table `p:` indicates the default constituent properties are prefixed with
34+
`project.` and `dm:` indicates the default constituent properties are prefixed with
35+
`project.distributionManagement.` e.g. for artifact parameter, the full default is
36+
`${project.artifactId}-${project.version}.${project.packaging}`
37+
38+
| Parameter | Default | Description |
39+
|--------------------|-----------------------------------------------------|-----------------------------------------------------------------------------------------|
40+
| artifact | p: ${artifactId}-${version}.${packaging} | The artifact within the project to query |
41+
| cmpChecksum | false | Compare checksums of artifacts |
42+
| failIfExists | false | Fail the build if the artifact already exists |
43+
| failIfNotExists | false | Fail the build if the artifact does not exist |
44+
| failIfNotMatch | false | Fail the build if the artifact exists and cmpChecksum is set and checksums do not match |
45+
| lastSnapshotTime | | The property to set with the timestamp of the last snapshot install / deploy |
46+
| project | p: ${groupId}:${artifactId}:${packaging}:${version} | The project within the repository to query |
47+
| property | ${maven.deploy.skip} _or_ ${maven.install.skip} | The property to receive the result of the query |
48+
| repository | dm: ${repository.url} | For remote goal, the repository to query for artifacts |
49+
| requireGoal | | Execute goal only if requireGoal value matches one of the maven command line goals |
50+
| serverId | dm: ${repository.id} | For remote goal, the server ID to use for authentication and proxy settings |
51+
| skip | false | Skip executing the plugin |
52+
| skipIfSnapshot | true | Skip the query if the project ends with -SNAPSHOT |
53+
| snapshotRepository | dm: ${snapshotRepository.url} | For remote goal, the repository to query for snapshot artifacts |
54+
| snapshotServerId | dm: ${snapshotRepository.id} | For remote goal, the server ID to use for snapshot authentication and proxy settings |
55+
| userProperty | false | If the property should be set as a user property, to be available in child projects |
5056

5157
## Requirements
5258

@@ -63,7 +69,7 @@ can be set from command line -Dexists.skip=true
6369
<plugin>
6470
<groupId>org.honton.chas</groupId>
6571
<artifactId>exists-maven-plugin</artifactId>
66-
<version>0.6.0</version>
72+
<version>0.7.0</version>
6773
<executions>
6874
<execution>
6975
<goals>
@@ -77,14 +83,21 @@ can be set from command line -Dexists.skip=true
7783
</build>
7884
```
7985

86+
## Snapshot builds
87+
88+
When checking snapshot builds against a remote/local repository, the last deployed/installed
89+
snapshot of the correct version will be matched. Optionally, you can configure a property with
90+
the `lastSnapshotTime` parameter which will receive the build timestamp. If you need additional date
91+
math on the timestamp value, open a feature request with your use case.
92+
8093
## Preventing failures of `remote` goal
8194

8295
Consider the scenario where there is an artifact that can only be deployed from a specific build
8396
server to a corporate repository with a specialized workflow that ensures various security and
8497
license policies. The exists-maven-plugin remote goal is also used to avoid duplicate deployments.
8598

8699
Running maven with the `install` phase will cause the exists-maven-plugin to execute the `remote`
87-
goal. This might fail for various reasons; including the developer laptop is not connected to the
100+
task. This might fail for various reasons; including the developer laptop is not connected to the
88101
internet, or the corporate repository is only available to specific build machines.
89102

90103
We could change the binding of the `remote` goal to the `deploy` phase. However, the
@@ -94,9 +107,11 @@ specified in the POM, with inherited executions running first."](https://maven.a
94107

95108
The solution is to leave the `remote` goal bound to the `install` phase and add a `requireGoal`
96109
configuration:
110+
97111
```xml
98-
<configuration>
99-
<!-- run only if deploy goal is specified in maven command ling -->
100-
<requireGoal>deploy</requireGoal>
101-
</configuration>
102-
```
112+
113+
<configuration>
114+
<!-- run only if deploy goal is specified in maven command ling -->
115+
<requireGoal>deploy</requireGoal>
116+
</configuration>
117+
```

0 commit comments

Comments
 (0)