Skip to content

Commit

Permalink
[MDEPLOY-301] Switch to the Maven 4 API
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jun 18, 2024
1 parent da2ad90 commit 9dbfb53
Show file tree
Hide file tree
Showing 47 changed files with 1,121 additions and 2,469 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3
with:
maven4-enabled: true

ff-maven: "4.0.0-beta-3" # Maven version for fail-fast-build
maven-matrix: '[ "4.0.0-beta-3" ]'
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ on:
- master
jobs:
update_release_draft:
uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4
uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v3
166 changes: 61 additions & 105 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ under the License.
</parent>

<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Deploy Plugin</name>
Expand All @@ -43,7 +43,7 @@ under the License.
</contributors>

<prerequisites>
<maven>3.6.3</maven>
<maven>${mavenVersion}</maven>
</prerequisites>

<scm>
Expand All @@ -68,156 +68,111 @@ under the License.
</distributionManagement>

<properties>
<javaVersion>8</javaVersion>
<mavenVersion>3.9.6</mavenVersion>
<javaVersion>17</javaVersion>
<mavenVersion>4.0.0-beta-3</mavenVersion>
<!-- Keep in sync with resolver used in maven above -->
<slf4jVersion>1.7.36</slf4jVersion>
<slf4jVersion>2.0.13</slf4jVersion>
<!-- Keep in sync with resolver used in maven above -->
<resolverVersion>1.9.20</resolverVersion>
<project.build.outputTimestamp>2022-07-16T16:14:30Z</project.build.outputTimestamp>

<!-- plugins version used in IT tests -->
<mavenAntrunPluginVersion>${version.maven-antrun-plugin}</mavenAntrunPluginVersion>
<mavenCompilerPluginVersion>${version.maven-compiler-plugin}</mavenCompilerPluginVersion>
<mavenEnforcerPluginVersion>${version.maven-enforcer-plugin}</mavenEnforcerPluginVersion>
<mavenInstallPluginVersion>${version.maven-install-plugin}</mavenInstallPluginVersion>
<mavenJarPluginVersion>${version.maven-jar-plugin}</mavenJarPluginVersion>
<mavenJavadocPluginVersion>${version.maven-javadoc-plugin}</mavenJavadocPluginVersion>
<mavenPluginToolsVersion>${version.maven-plugin-tools}</mavenPluginToolsVersion>
<mavenResourcesPluginVersion>${version.maven-resources-plugin}</mavenResourcesPluginVersion>
<mavenSourcePluginVersion>${version.maven-source-plugin}</mavenSourcePluginVersion>
<mavenSurefirePluginVersion>${version.maven-surefire}</mavenSurefirePluginVersion>
<mavenWarPluginVersion>${version.maven-war-plugin}</mavenWarPluginVersion>

<project.build.outputTimestamp>2024-04-26T10:30:44Z</project.build.outputTimestamp>
<mavenAntrunPluginVersion>3.1.0</mavenAntrunPluginVersion>
<mavenCompilerPluginVersion>3.11.0</mavenCompilerPluginVersion>
<mavenEnforcerPluginVersion>3.1.0</mavenEnforcerPluginVersion>
<mavenInstallPluginVersion>3.1.0</mavenInstallPluginVersion>
<mavenJarPluginVersion>3.3.0</mavenJarPluginVersion>
<mavenJavadocPluginVersion>3.4.1</mavenJavadocPluginVersion>
<mavenPluginPluginVersion>4.0.0-SNAPSHOT</mavenPluginPluginVersion>
<mavenPluginTestingHarnessVersion>4.0.0-alpha-3-SNAPSHOT</mavenPluginTestingHarnessVersion>
<mavenResourcesPluginVersion>3.3.0</mavenResourcesPluginVersion>
<mavenSourcePluginVersion>3.2.1</mavenSourcePluginVersion>
<mavenSurefirePluginVersion>${surefire.version}</mavenSurefirePluginVersion>
<mavenWarPluginVersion>3.3.2</mavenWarPluginVersion>

<version.plexus-xml>4.0.1</version.plexus-xml>

<project.build.outputTimestamp>2023-03-21T14:38:01Z</project.build.outputTimestamp>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<artifactId>maven-api-core</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<artifactId>maven-api-model</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>${resolverVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-util</artifactId>
<version>${resolverVersion}</version>
<!-- To work in Maven versions older than 3.9.0 -->
<scope>compile</scope>
</dependency>

<!-- dependencies to annotations -->
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>jakarta.inject</groupId>-->
<!-- <artifactId>jakarta.inject-api</artifactId>-->
<!-- <version>2.0.1</version>-->
<!-- </dependency>-->

<!-- Test -->
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.3.0</version>
<version>${mavenPluginTestingHarnessVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- used by maven-plugin-testing-harness, don't give it compile scope! -->
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-file</artifactId>
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>

<!-- <dependency>-->
<!-- <groupId>org.apache.maven.plugin-tools</groupId>-->
<!-- <artifactId>maven-plugin-annotations</artifactId>-->
<!-- <scope>none</scope>-->
<!-- </dependency>-->

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${mavenPluginPluginVersion}</version>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<proc>none</proc>
<showDeprecation>true</showDeprecation>
<java>
<includes>
<include>src/**/*.java</include>
</includes>
</java>
</configuration>
</plugin>
</plugins>
Expand All @@ -232,6 +187,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<debug>true</debug>
<showErrors>true</showErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import groovy.xml.*;

assert new File( basedir, "target/repo/org/apache/maven/plugins/deploy/its/mdeploy178/1.0/mdeploy178-1.0.jar" ).exists()
File deployedPom = new File( basedir, "target/repo/org/apache/maven/plugins/deploy/its/mdeploy178/1.0/mdeploy178-1.0.pom" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@
* under the License.
*/

def expectedDeploys = [
'org/apache/maven/its/mdeploy-170/configperproject/1.0/configperproject-1.0.pom',
'org/apache/maven/plugins/deploy/it/org.eclipse.equinox.common/1.0/org.eclipse.equinox.common-1.0-sources.jar',
'org/apache/maven/plugins/deploy/it/org.eclipse.equinox.common/1.0/org.eclipse.equinox.common-1.0.jar',
'org/apache/maven/plugins/deploy/it/org.eclipse.equinox.common/1.0/org.eclipse.equinox.common-1.0.pom',
'org/apache/maven/plugins/deploy/it/org.eclipse.osgi/1.0/org.eclipse.osgi-1.0-sources.jar',
'org/apache/maven/plugins/deploy/it/org.eclipse.osgi/1.0/org.eclipse.osgi-1.0.jar',
'org/apache/maven/plugins/deploy/it/org.eclipse.osgi/1.0/org.eclipse.osgi-1.0.pom'
]

def repoDir = new File ( basedir, 'target/repo')

def missingDeploys = expectedDeploys.findAll { ! new File(repoDir, it).isFile() }

assert missingDeploys.size() == 0
def buildLog = new File ( basedir, "build.log")

assert buildLog.text =~ /Uploading.*file:target\/repo\/org\/apache\/maven\/plugins\/deploy\/it\/org\.eclipse\.osgi\/1\.0\/org\.eclipse\.osgi-1\.0-sources\.jar/
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.test;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -9,7 +7,7 @@
* "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
* 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
Expand All @@ -18,20 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.test;

/**
* Hello World class
*/
public class HelloWorld
{
public class HelloWorld {

/**
* Main method
* @param args Arguments
*/
public static void main( String[] args )
{
System.out.println( "Hello world" );
public static void main(String[] args) {
System.out.println("Hello world");
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.maven.test;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -9,7 +7,7 @@
* "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
* 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
Expand All @@ -18,20 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.test;

/**
* Hello World class
*/
public class HelloWorld
{
public class HelloWorld {

/**
* Main method
* @param args Arguments
*/
public static void main( String[] args )
{
System.out.println( "Hello world" );
public static void main(String[] args) {
System.out.println("Hello world");
}

}
23 changes: 23 additions & 0 deletions src/it/deploy-at-end-pass/module1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,27 @@
</parent>
<artifactId>module1</artifactId>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>@mavenEnforcerPluginVersion@</version>
<executions>
<execution>
<id>enforce</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<AlwaysPass />
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 9dbfb53

Please sign in to comment.