Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRELEASE-1123] Fix for Maven 4 compatibility #186

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public interface ReleaseDescriptor {
/**
* Get the (optional) config for the VersionPolicy implementation used to calculate the project versions.
*
* @return The parsed XML of the provided config (an instance of XmlPlexusConfiguration) or null.
* @return The parsed XML of the provided config (an instance of PlexusConfiguration) or null.
*/
Object getProjectVersionPolicyConfig();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,10 @@ private List<Plugin> createReleasePlugins(ReleaseDescriptor releaseDescriptor, M
}
releasePlugin.setExecutions(plugin.getExecutions());
releasePlugin.setDependencies(plugin.getDependencies());
releasePlugin.setGoals(plugin.getGoals());
slawekjaranowski marked this conversation as resolved.
Show resolved Hide resolved
releasePlugin.setInherited(plugin.getInherited());
releasePlugin.setConfiguration(plugin.getConfiguration());
if (plugin.getConfiguration() != null) {
releasePlugin.setConfiguration(plugin.getConfiguration());
michael-o marked this conversation as resolved.
Show resolved Hide resolved
}

releasePlugins.add(releasePlugin);
}
Expand Down
1 change: 1 addition & 0 deletions maven-release-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<updateWorkingCopyVersions>false</updateWorkingCopyVersions>
<updateBranchVersions>true</updateBranchVersions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

def projectBranch = new XmlSlurper().parse( new File( basedir, "pom.xml.branch" ) )
assert projectBranch.version.text() == "2.6.0-BRANCH-SNAPSHOT"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<!-- TODO fix test with current version -->
<version>2.5.3</version>
<configuration>
<suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
<branchName>branch-mrelease-745</branchName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
assert project.version.text() == "1.0-SNAPSHOT"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<version>@mavenEnforcerPluginVersion@</version>
<executions>
<execution>
<id>enforce</id>
Expand Down Expand Up @@ -94,7 +94,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<version>@mavenEnforcerPluginVersion@</version>
<executions>
<execution>
<id>enforce</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

// check parent project
def project = new XmlSlurper().parse( new File( new File ( basedir, 'module-parent' ), 'pom.xml.next' ) )
assert project.version.text() == '1.1-SNAPSHOT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.3.0</version>
<version>@mavenHelpPluginVersion@</version>
<executions>
<execution>
<id>Show profiles</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
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)")
assert buildLog.text.contains( "[INFO] - PrepProfA (source: ")
assert buildLog.text.contains( "[INFO] - PrepProfB (source: ")
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
* under the License.
*/

import groovy.xml.XmlSlurper


File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0.1</version>
<version>@mavenEnforcerPluginVersion@</version>
<executions>
<execution>
<goals>
Expand All @@ -64,7 +64,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0.1</version>
<version>@mavenEnforcerPluginVersion@</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
</dependency>
</dependencies>
<configuration>
<arguments>-Prelease,!mrelease-677 ${arguments}</arguments>
<arguments>-P!mrelease-677 ${arguments}</arguments>
<preparationGoals>help:all-profiles</preparationGoals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.1.1</version>
<version>@mavenHelpPluginVersion@</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ assert buildLog.exists()
// Can only be checked with M3
//assert 1 == buildLog.getText().count("[DEBUG] Profile with id: 'mrelease-677' has been explicitly activated.")

assert 1 == buildLog.getText().count(" Profile Id: mrelease-677 (Active: false , Source: settings.xml)")
assert 1 == buildLog.getText().count(" Profile Id: mrelease-677 (Active: false, Source: settings.xml)")
assert buildLog.getText().contains("[WARNING] arguments parameter contains unresolved property: '\${arguments}'")
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
assert project.version.text() == "1.0-SNAPSHOT"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
assert project.version.text() == "1.0-SNAPSHOT"
assert project.parent.version.text() == "1-SNAPSHOT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
assert project['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

// verifies that the version is unchanged because of the custom policy: 1.0-SNAPSHOT -> 1.0 -> 1.0-SNAPSHOT
def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) )
assert project.version.text() == "1.0-SNAPSHOT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.maven.shared.release.ReleaseExecutionException;
import org.apache.maven.shared.release.ReleaseFailureException;
import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfiguration;

/**
* Branch a project in SCM, using the same steps as the <code>release:prepare</code> goal, creating a branch instead of
Expand Down Expand Up @@ -204,7 +204,7 @@ public class BranchReleaseMojo extends AbstractScmReleaseMojo {
* @since 3.0.0
*/
@Parameter(property = "projectVersionPolicyConfig")
private XmlPlexusConfiguration projectVersionPolicyConfig;
private PlexusConfiguration projectVersionPolicyConfig;

/**
* The role-hint for the {@link org.apache.maven.shared.release.policy.naming.NamingPolicy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.apache.maven.shared.release.ReleaseFailureException;
import org.apache.maven.shared.release.ReleasePrepareRequest;
import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfiguration;

/**
* Prepare for a release in SCM. Steps through several phases to ensure the POM is ready to be released and then
Expand Down Expand Up @@ -250,7 +250,7 @@ public class PrepareReleaseMojo extends AbstractScmReleaseMojo {
* @since 3.0.0
*/
@Parameter(property = "projectVersionPolicyConfig")
private XmlPlexusConfiguration projectVersionPolicyConfig;
private PlexusConfiguration projectVersionPolicyConfig;

/**
* The role-hint for the {@link org.apache.maven.shared.release.policy.naming.NamingPolicy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.maven.shared.release.ReleaseFailureException;
import org.apache.maven.shared.release.ReleaseUpdateVersionsRequest;
import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfiguration;

/**
* Update the POM versions for a project. This performs the normal version updates of the <code>release:prepare</code>
Expand Down Expand Up @@ -97,7 +97,7 @@ public class UpdateVersionsMojo extends AbstractReleaseMojo {
* @since 3.0.0
*/
@Parameter(property = "projectVersionPolicyConfig")
private XmlPlexusConfiguration projectVersionPolicyConfig;
private PlexusConfiguration projectVersionPolicyConfig;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@

<mavenCompilerPluginVersion>3.11.0</mavenCompilerPluginVersion>
<mavenInvokerPluginVersion>3.5.0</mavenInvokerPluginVersion>
<mavenEnforcerPluginVersion>3.3.0</mavenEnforcerPluginVersion>
<mavenHelpPluginVersion>3.4.0</mavenHelpPluginVersion>
</properties>

<dependencyManagement>
Expand Down