This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-release.git
The following commit(s) were added to refs/heads/master by this push: new 3064cffd [MRELEASE-1077] Add support for prepare-specific profiles 3064cffd is described below commit 3064cffdffceaedf2d926d06b1a483edcd5e4043 Author: Niels Basjes <ni...@basjes.nl> AuthorDate: Sun Feb 6 15:26:49 2022 +0100 [MRELEASE-1077] Add support for prepare-specific profiles This closes #101 --- .../prepare/MRELEASE-1077/invoker.properties | 18 +++++ .../src/it/projects/prepare/MRELEASE-1077/pom.xml | 78 ++++++++++++++++++++++ .../projects/prepare/MRELEASE-1077/verify.groovy | 24 +++++++ .../maven/plugins/release/PrepareReleaseMojo.java | 14 ++++ 4 files changed, 134 insertions(+) diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/invoker.properties b/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/invoker.properties new file mode 100644 index 00000000..43b6c5fc --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/invoker.properties @@ -0,0 +1,18 @@ +# 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. + +invoker.goals = release:clean release:prepare \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/pom.xml new file mode 100644 index 00000000..807c401d --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<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"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugin.release.its</groupId> + <artifactId>mrelease-1077</artifactId> + <version>1.0-SNAPSHOT</version> + <scm> + <developerConnection>scm:dummy|nul</developerConnection> + </scm> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-release-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <connectionUrl>scm:dummy|nul</connectionUrl> + <username>perform_username</username> + <password>perform_password</password> + <preparationProfiles>PrepProfA,PrepProfB</preparationProfiles> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.its.release</groupId> + <artifactId>maven-scm-provider-dummy</artifactId> + <version>1.0</version> + </dependency> + </dependencies> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-help-plugin</artifactId> + <version>3.3.0</version> + <executions> + <execution> + <id>Show profiles</id> + <phase>validate</phase> + <goals> + <goal>active-profiles</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>PrepProfA</id> + </profile> + + <profile> + <id>PrepProfB</id> + </profile> + </profiles> + +</project> diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/verify.groovy new file mode 100644 index 00000000..a0e52dc9 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/verify.groovy @@ -0,0 +1,24 @@ +/* + * 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. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.text.contains( "[INFO] - PrepProfA (source: org.apache.maven.plugin.release.its:mrelease-1077:1.0-SNAPSHOT)") +assert buildLog.text.contains( "[INFO] - PrepProfB (source: org.apache.maven.plugin.release.its:mrelease-1077:1.0-SNAPSHOT)") diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java index e7403b99..0d24ab4a 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java @@ -102,6 +102,12 @@ public class PrepareReleaseMojo extends AbstractScmReleaseMojo { @Parameter(defaultValue = "true", property = "addSchema") private boolean addSchema; + /** + * Comma separated profiles to enable on release prepare, in addition to active profiles for project execution. + */ + @Parameter(property = "preparationProfiles") + private String preparationProfiles; + /** * Goals to run as part of the preparation step, after transformation but before committing. Space delimited. */ @@ -323,6 +329,14 @@ public class PrepareReleaseMojo extends AbstractScmReleaseMojo { @Parameter(defaultValue = "false", property = "pinExternals") private boolean pinExternals; + /** + * {@inheritDoc} + */ + @Override + protected String getAdditionalProfiles() { + return preparationProfiles; + } + /** * Specifies the line separator to format pom.xml. The following properties are * available: