Skip to content

Commit

Permalink
[MRELEASE-1077] Add support for prepare-specific profiles
Browse files Browse the repository at this point in the history
This closes #101
  • Loading branch information
nielsbasjes authored and michael-o committed Mar 12, 2023
1 parent 4402491 commit 3064cff
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
78 changes: 78 additions & 0 deletions maven-release-plugin/src/it/projects/prepare/MRELEASE-1077/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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)")
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3064cff

Please sign in to comment.