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

[MSOURCES-149] Switch to the Maven 4 API #19

Merged
merged 2 commits into from
Jun 24, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4
with:
ff-maven: "4.0.0-beta-3" # Maven version for fail-fast-build
maven-matrix: '[ "4.0.0-beta-3" ]'
jdk-matrix: '[ "17", "21" ]'
94 changes: 68 additions & 26 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ under the License.
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>41</version>
<version>42</version>
<relativePath />
</parent>

<artifactId>maven-source-plugin</artifactId>
<version>3.3.2-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Source Plugin</name>
Expand Down Expand Up @@ -77,92 +77,134 @@ under the License.
</distributionManagement>

<properties>
<javaVersion>8</javaVersion>
<mavenVersion>3.2.5</mavenVersion>
<javaVersion>17</javaVersion>
<mavenVersion>4.0.0-beta-3</mavenVersion>

<guiceVersion>6.0.0</guiceVersion>
<junitVersion>5.10.2</junitVersion>
<mavenArchiverVersion>4.0.0-SNAPSHOT</mavenArchiverVersion>
<mavenPluginPluginVersion>4.0.0-SNAPSHOT</mavenPluginPluginVersion>
<mavenPluginTestingVersion>4.0.0-alpha-3-SNAPSHOT</mavenPluginTestingVersion>
<mockitoVersion>5.12.0</mockitoVersion>
<plexusArchiverVersion>4.9.2</plexusArchiverVersion>
<version.maven-plugin-tools>${mavenPluginPluginVersion}</version.maven-plugin-tools>
<version.maven-invoker-plugin>3.7.0</version.maven-invoker-plugin>

<project.build.outputTimestamp>2024-03-30T01:49:10Z</project.build.outputTimestamp>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.26.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
</dependency>
</dependencies>
</dependencyManagement>

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

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

<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>3.6.2</version>
<version>${mavenArchiverVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>4.9.2</version>
<version>${plexusArchiverVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
</dependency>

<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.3.0</version>
<version>${mavenPluginTestingVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<artifactId>maven-api-impl</artifactId>
<version>${mavenVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guiceVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junitVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockitoVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<java>
<includes>
<include>src/**/*.java</include>
</includes>
</java>
<pom>
<includes>
<include>**/pom.xml</include>
</includes>
</pom>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
Expand Down
10 changes: 3 additions & 7 deletions src/it/MSOURCES-121/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,19 @@
~ 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">
<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.its.sources</groupId>
<artifactId>jar-no-fork</artifactId>
<version>1.0-SNAPSHOT</version>

<name>Test for multiple attachments of files</name>
<description>This build should fail based on the duplicate
<description>This build should fail based on the duplicate
execution with the same configuration. This will erroneously
add the classifier/file twice.
MSOURCES-121.
update with MSOURCES-141: do not fail but detect and not add twice
</description>
update with MSOURCES-141: do not fail but detect and not add twice</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
10 changes: 3 additions & 7 deletions src/it/MSOURCES-121/src/main/java/MyClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
* 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.
*/

public class MyClass
{

}
public class MyClass {}
10 changes: 3 additions & 7 deletions src/it/MSOURCES-121/src/test/java/MyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
* 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.
*/

public class MyTest
{

}
public class MyTest {}
3 changes: 2 additions & 1 deletion src/it/MSOURCES-121/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@

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

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/
var fs = File.separatorChar == '\\' ? "\\\\" : "/"
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/
3 changes: 3 additions & 0 deletions src/it/MSOURCES-140/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
# under the License.
invoker.buildResult = success
invoker.goals = package clean install

# maven 4.0.0-beta-3 is broken because of https://github.com/apache/maven/pull/1587
invoker.maven.version = 4.0.0-beta-4+
5 changes: 1 addition & 4 deletions src/it/MSOURCES-140/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
~ 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">
<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.its.sources</groupId>
Expand Down
10 changes: 3 additions & 7 deletions src/it/MSOURCES-140/src/main/java/MyClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
* 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.
*/

public class MyClass
{

}
public class MyClass {}
10 changes: 3 additions & 7 deletions src/it/MSOURCES-140/src/test/java/MyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
* 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.
*/

public class MyTest
{

}
public class MyTest {}
2 changes: 1 addition & 1 deletion src/it/MSOURCES-140/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

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

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\)/
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\)/
5 changes: 1 addition & 4 deletions src/it/MSOURCES-62/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ 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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.ejb</groupId>
Expand All @@ -41,7 +39,6 @@ under the License.
<phase>package</phase>
<configuration>
<archive>
<index>true</index>
<addMavenDescriptor>false</addMavenDescriptor>
<compress>true</compress>
<manifestEntries>
Expand Down
4 changes: 1 addition & 3 deletions src/it/MSOURCES-64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ 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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.ejb</groupId>
Expand Down
5 changes: 1 addition & 4 deletions src/it/MSOURCES-95/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
~ 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-4.0.0.xsd">
<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-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.source</groupId>
Expand Down
8 changes: 2 additions & 6 deletions src/it/jar-attached/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
~ 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">
<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.its.ejb</groupId>
Expand All @@ -42,11 +39,10 @@
<executions>
<execution>
<id>attach-sources</id>
<configuration>
</configuration>
<goals>
<goal>jar</goal>
</goals>
<configuration />
</execution>
</executions>
</plugin>
Expand Down
Loading