Skip to content

Commit 0853c45

Browse files
committed
[MSOURCES-149] Switch to the Maven 4 API
IT MSOURCES-140 is broken because of apache/maven#1587
1 parent 13f1f87 commit 0853c45

31 files changed

+568
-1299
lines changed

.github/workflows/maven-verify.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ jobs:
2525
build:
2626
name: Verify
2727
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
28+
with:
29+
ff-maven: "4.0.0-beta-3" # Maven version for fail-fast-build
30+
maven-matrix: '[ "4.0.0-beta-3" ]'
31+
jdk-matrix: '[ "17", "21" ]'

pom.xml

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ under the License.
2323
<parent>
2424
<groupId>org.apache.maven.plugins</groupId>
2525
<artifactId>maven-plugins</artifactId>
26-
<version>41</version>
26+
<version>42</version>
2727
<relativePath />
2828
</parent>
2929

3030
<artifactId>maven-source-plugin</artifactId>
31-
<version>3.3.2-SNAPSHOT</version>
31+
<version>4.0.0-SNAPSHOT</version>
3232
<packaging>maven-plugin</packaging>
3333

3434
<name>Apache Maven Source Plugin</name>
@@ -77,86 +77,112 @@ under the License.
7777
</distributionManagement>
7878

7979
<properties>
80-
<javaVersion>8</javaVersion>
81-
<mavenVersion>3.2.5</mavenVersion>
80+
<javaVersion>17</javaVersion>
81+
<mavenVersion>4.0.0-beta-3</mavenVersion>
82+
83+
<guiceVersion>6.0.0</guiceVersion>
84+
<junitVersion>5.10.2</junitVersion>
85+
<mavenArchiverVersion>4.0.0-SNAPSHOT</mavenArchiverVersion>
86+
<mavenPluginPluginVersion>4.0.0-SNAPSHOT</mavenPluginPluginVersion>
87+
<mavenPluginTestingVersion>4.0.0-alpha-3-SNAPSHOT</mavenPluginTestingVersion>
88+
<mockitoVersion>5.12.0</mockitoVersion>
89+
<plexusArchiverVersion>4.9.2</plexusArchiverVersion>
90+
<version.maven-plugin-tools>${mavenPluginPluginVersion}</version.maven-plugin-tools>
91+
<version.maven-invoker-plugin>3.7.0</version.maven-invoker-plugin>
92+
8293
<project.build.outputTimestamp>2024-03-30T01:49:10Z</project.build.outputTimestamp>
8394
</properties>
8495

8596
<dependencyManagement>
8697
<dependencies>
8798
<dependency>
88-
<groupId>commons-io</groupId>
89-
<artifactId>commons-io</artifactId>
90-
<version>2.16.1</version>
99+
<groupId>org.apache.commons</groupId>
100+
<artifactId>commons-compress</artifactId>
101+
<version>1.26.1</version>
102+
</dependency>
103+
<dependency>
104+
<groupId>com.google.guava</groupId>
105+
<artifactId>guava</artifactId>
106+
<version>32.0.1-jre</version>
91107
</dependency>
92108
</dependencies>
93109
</dependencyManagement>
94110

95111
<dependencies>
96112
<dependency>
97113
<groupId>org.apache.maven</groupId>
98-
<artifactId>maven-model</artifactId>
114+
<artifactId>maven-api-core</artifactId>
99115
<version>${mavenVersion}</version>
100116
<scope>provided</scope>
101117
</dependency>
102118
<dependency>
103119
<groupId>org.apache.maven</groupId>
104-
<artifactId>maven-plugin-api</artifactId>
120+
<artifactId>maven-api-di</artifactId>
105121
<version>${mavenVersion}</version>
106122
<scope>provided</scope>
107123
</dependency>
108124
<dependency>
109125
<groupId>org.apache.maven</groupId>
110-
<artifactId>maven-artifact</artifactId>
126+
<artifactId>maven-api-model</artifactId>
111127
<version>${mavenVersion}</version>
112128
<scope>provided</scope>
113129
</dependency>
114130
<dependency>
115131
<groupId>org.apache.maven</groupId>
116-
<artifactId>maven-core</artifactId>
132+
<artifactId>maven-api-meta</artifactId>
117133
<version>${mavenVersion}</version>
118134
<scope>provided</scope>
119135
</dependency>
120136

121-
<!-- dependencies to annotations -->
122-
<dependency>
123-
<groupId>org.apache.maven.plugin-tools</groupId>
124-
<artifactId>maven-plugin-annotations</artifactId>
125-
<scope>provided</scope>
126-
</dependency>
127-
128137
<dependency>
129138
<groupId>org.apache.maven</groupId>
130139
<artifactId>maven-archiver</artifactId>
131-
<version>3.6.2</version>
140+
<version>${mavenArchiverVersion}</version>
132141
</dependency>
133142
<dependency>
134143
<groupId>org.codehaus.plexus</groupId>
135144
<artifactId>plexus-archiver</artifactId>
136-
<version>4.9.2</version>
145+
<version>${plexusArchiverVersion}</version>
137146
</dependency>
138147
<dependency>
139148
<groupId>org.codehaus.plexus</groupId>
140149
<artifactId>plexus-utils</artifactId>
141-
<version>3.5.1</version>
142150
</dependency>
143151

144152
<dependency>
145153
<groupId>org.apache.maven.plugin-testing</groupId>
146154
<artifactId>maven-plugin-testing-harness</artifactId>
147-
<version>3.3.0</version>
155+
<version>${mavenPluginTestingVersion}</version>
156+
<scope>test</scope>
157+
</dependency>
158+
<dependency>
159+
<groupId>org.apache.maven</groupId>
160+
<artifactId>maven-core</artifactId>
161+
<version>${mavenVersion}</version>
148162
<scope>test</scope>
149163
</dependency>
150164
<dependency>
151165
<groupId>org.apache.maven</groupId>
152-
<artifactId>maven-compat</artifactId>
166+
<artifactId>maven-api-impl</artifactId>
153167
<version>${mavenVersion}</version>
154168
<scope>test</scope>
155169
</dependency>
156170
<dependency>
157-
<groupId>junit</groupId>
158-
<artifactId>junit</artifactId>
159-
<version>4.13.2</version>
171+
<groupId>com.google.inject</groupId>
172+
<artifactId>guice</artifactId>
173+
<version>${guiceVersion}</version>
174+
<scope>test</scope>
175+
</dependency>
176+
<dependency>
177+
<groupId>org.junit.jupiter</groupId>
178+
<artifactId>junit-jupiter-api</artifactId>
179+
<version>${junitVersion}</version>
180+
<scope>test</scope>
181+
</dependency>
182+
<dependency>
183+
<groupId>org.mockito</groupId>
184+
<artifactId>mockito-core</artifactId>
185+
<version>${mockitoVersion}</version>
160186
<scope>test</scope>
161187
</dependency>
162188
</dependencies>

src/it/MSOURCES-121/verify.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919

2020
File buildLog = new File( basedir, 'build.log' )
2121

22-
assert buildLog.text =~ /\[ERROR\] Artifact org.apache.maven.its.sources:jar-no-fork:java-source:sources:1.0-SNAPSHOT already attached to a file target.jar-no-fork-1.0-SNAPSHOT-sources.jar: attach to target.jar-no-fork-1.0-SNAPSHOT-secondary-sources.jar should be done with another classifier/
22+
var fs = File.separatorChar == '\\' ? "\\\\" : "/"
23+
assert buildLog.text =~ /\[ERROR\] Artifact org.apache.maven.its.sources:jar-no-fork:jar:sources:1.0-SNAPSHOT already attached to a file target${fs}jar-no-fork-1.0-SNAPSHOT-sources.jar: attach to target${fs}jar-no-fork-1.0-SNAPSHOT-secondary-sources.jar should be done with another classifier/

src/it/MSOURCES-140/invoker.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
# under the License.
1717
invoker.buildResult = success
1818
invoker.goals = package clean install
19+
20+
# maven 4.0.0-beta-3 is broken because of https://github.com/apache/maven/pull/1587
21+
invoker.maven.version = 4.0.0-beta-4+

src/it/MSOURCES-140/verify.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
File buildLog = new File( basedir, 'build.log' )
2121

22-
assert buildLog.text =~ /\[INFO\] Artifact org.apache.maven.its.sources:jar-no-fork:java-source:sources:1.0-SNAPSHOT already attached to target.jar-no-fork-1.0-SNAPSHOT-sources.jar: ignoring same re-attach \(same artifact, same file\)/
22+
assert buildLog.text =~ /\[INFO\] Artifact org.apache.maven.its.sources:jar-no-fork:jar:sources:1.0-SNAPSHOT already attached to target" + File.separator + "jar-no-fork-1.0-SNAPSHOT-sources.jar: ignoring same re-attach \(same artifact, same file\)/

src/it/MSOURCES-62/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ under the License.
3939
<phase>package</phase>
4040
<configuration>
4141
<archive>
42-
<index>true</index>
4342
<addMavenDescriptor>false</addMavenDescriptor>
4443
<compress>true</compress>
4544
<manifestEntries>

0 commit comments

Comments
 (0)