Skip to content

Commit 3064cff

Browse files
nielsbasjesmichael-o
authored andcommitted
[MRELEASE-1077] Add support for prepare-specific profiles
This closes #101
1 parent 4402491 commit 3064cff

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = release:clean release:prepare
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
23+
<groupId>org.apache.maven.plugin.release.its</groupId>
24+
<artifactId>mrelease-1077</artifactId>
25+
<version>1.0-SNAPSHOT</version>
26+
<scm>
27+
<developerConnection>scm:dummy|nul</developerConnection>
28+
</scm>
29+
30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-release-plugin</artifactId>
35+
<version>@project.version@</version>
36+
<configuration>
37+
<connectionUrl>scm:dummy|nul</connectionUrl>
38+
<username>perform_username</username>
39+
<password>perform_password</password>
40+
<preparationProfiles>PrepProfA,PrepProfB</preparationProfiles>
41+
</configuration>
42+
<dependencies>
43+
<dependency>
44+
<groupId>org.apache.maven.its.release</groupId>
45+
<artifactId>maven-scm-provider-dummy</artifactId>
46+
<version>1.0</version>
47+
</dependency>
48+
</dependencies>
49+
</plugin>
50+
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-help-plugin</artifactId>
54+
<version>3.3.0</version>
55+
<executions>
56+
<execution>
57+
<id>Show profiles</id>
58+
<phase>validate</phase>
59+
<goals>
60+
<goal>active-profiles</goal>
61+
</goals>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
</plugins>
66+
</build>
67+
68+
<profiles>
69+
<profile>
70+
<id>PrepProfA</id>
71+
</profile>
72+
73+
<profile>
74+
<id>PrepProfB</id>
75+
</profile>
76+
</profiles>
77+
78+
</project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
File buildLog = new File( basedir, 'build.log' )
21+
assert buildLog.exists()
22+
23+
assert buildLog.text.contains( "[INFO] - PrepProfA (source: org.apache.maven.plugin.release.its:mrelease-1077:1.0-SNAPSHOT)")
24+
assert buildLog.text.contains( "[INFO] - PrepProfB (source: org.apache.maven.plugin.release.its:mrelease-1077:1.0-SNAPSHOT)")

maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ public class PrepareReleaseMojo extends AbstractScmReleaseMojo {
102102
@Parameter(defaultValue = "true", property = "addSchema")
103103
private boolean addSchema;
104104

105+
/**
106+
* Comma separated profiles to enable on release prepare, in addition to active profiles for project execution.
107+
*/
108+
@Parameter(property = "preparationProfiles")
109+
private String preparationProfiles;
110+
105111
/**
106112
* Goals to run as part of the preparation step, after transformation but before committing. Space delimited.
107113
*/
@@ -323,6 +329,14 @@ public class PrepareReleaseMojo extends AbstractScmReleaseMojo {
323329
@Parameter(defaultValue = "false", property = "pinExternals")
324330
private boolean pinExternals;
325331

332+
/**
333+
* {@inheritDoc}
334+
*/
335+
@Override
336+
protected String getAdditionalProfiles() {
337+
return preparationProfiles;
338+
}
339+
326340
/**
327341
* Specifies the line separator to format pom.xml. The following properties are
328342
* available:

0 commit comments

Comments
 (0)