-
Notifications
You must be signed in to change notification settings - Fork 265
/
unlock-snapshots.apt
104 lines (80 loc) · 3.49 KB
/
unlock-snapshots.apt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you 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.
-----
Unlocking snapshot dependencies
-----
Stephen Connolly, Paul Gier
------
2009-04-20
------
Unlocking snapshot dependencies
If your pom contains a lot of -SNAPSHOT dependencies and those -SNAPSHOT dependencies are a moving target, it
can sometimes be helpful to temporarily replace the -SNAPSHOT with a locked -YYYYMMDD.HHMMSS-NNN snapshot.
In the long term, you will need to return to the -SNAPSHOT dependencies and then replace them with their
release version, but if you need a short term semi-reproducible build, locked -SNAPSHOTs can sometimes be a
useful hack.
If your pom has specified locked snapshot versions (these will end with the form -YYYYMMDD.HHMMSS-NNN) for certain
ependencies:
+---+
<dependencies>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-api</artifactId>
<version>1.0-20081117.213112-16</version>
</dependency>
</dependencies>
+---+
Using the <<<unlock-snapshots>>> goal, the locked snapshot versions can be unlocked again to regular -SNAPSHOT
versions.
---
mvn versions:unlock-snapshots
---
The pom dependencies are modified to look like the following.
+---+
<dependencies>
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-core-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
+---+
You can restrict which dependencies should have their -SNAPSHOT versions unlocked. For example,
the following will only match dependencies that match the groupId "org.codehaus.plexus" and artifactId
"plexus-utils"
---
mvn versions:unlock-snapshots -Dincludes=org.codehaus.plexus:plexus-utils
---
The <<<includes>>> and <<<excludes>>> parameters follow the format <<<groupId:artifactId:type:classifier>>>.
Use a comma separated separated list to specify multiple includes. Wildcards (*) can also be used to match
multiple values.
This example will match anything with the groupId "org.codehaus.plexus" and anything with the groupId and
artifactId matching "junit".
---
mvn versions:unlock-snapshots -Dincludes=org.codehaus.plexus:*,junit:junit
---
By default, both the <<<project/dependencyManagment>>> and <<<project/dependencies>>> sections will be processed.
You can use the <<<processDependencies>>> and <<<processDependencyManagement>>> parameters to control which sections
are processed.
This example will only process the <<<project/dependencyManagment>>> section of your pom:
---
mvn versions:unlock-snapshots -DprocessDependencies=false
---
While this example will only process the <<<project/dependencies>>> section of your pom:
---
mvn versions:unlock-snapshots -DprocessDependencyManagement=false
---