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

Update Maven to 3.5.0 - fix for Maven 4 #351

Merged
merged 7 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</scm>

<properties>
<mavenVersion>3.2.5</mavenVersion>
<mavenVersion>3.5.0</mavenVersion>
<recommendedJavaBuildVersion>11</recommendedJavaBuildVersion>
<project.build.outputTimestamp>2023-03-27T21:27:03Z</project.build.outputTimestamp>
</properties>
Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/bom-flattenMode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/bom-pomElements/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/complete-artifact-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
1 change: 0 additions & 1 deletion src/it/projects/complete-artifact-pom/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ assert 1 == originalProject.pluginRepositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/complete-mavenplugin-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
1 change: 0 additions & 1 deletion src/it/projects/complete-mavenplugin-pom/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ assert 1 == originalProject.parent.size()
assert 1 == originalProject.pluginRepositories.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ assert 1 == originalProject.pluginRepositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports />

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ assert 1 == originalProject.pluginRepositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/complete-multimodule-parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ assert 1 == originalProject.pluginRepositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/external-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
1 change: 0 additions & 1 deletion src/it/projects/external-parent/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ assert 1 == originalProject.repositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 1 addition & 1 deletion src/it/projects/issue-348-repository-from-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.0.0-M5</version>
<version>3.0.0-RC2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
1 change: 0 additions & 1 deletion src/it/projects/jdk-profile-inactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
<reporting>
<outputDirectory>target/site</outputDirectory>
</reporting>
<reports/>
</profile>
</profiles>
</project>
1 change: 0 additions & 1 deletion src/it/projects/jdk-profile-inactive/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ assert 1 == originalProject.profiles.profile.modules.size()
assert 1 == originalProject.profiles.profile.pluginRepositories.size()
assert 1 == originalProject.profiles.profile.properties.size()
assert 1 == originalProject.profiles.profile.reporting.size()
assert 1 == originalProject.profiles.profile.reports.size()

File flattendPom = new File( basedir, '.flattened-pom.xml' )
assert flattendPom.exists()
Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/optional-elements-modeMinimum/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ assert 1 == originalProject.repositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/optional-elements-modeOss/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
1 change: 0 additions & 1 deletion src/it/projects/optional-elements-modeOss/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ assert 1 == originalProject.repositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/optional-elements-modeOssrh/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
1 change: 0 additions & 1 deletion src/it/projects/optional-elements-modeOssrh/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ assert 1 == originalProject.repositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/optional-elements-pomElements-legacy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@
<outputDirectory>target/site</outputDirectory>
</reporting>

<reports/>

<scm>
<url>http://svn.codehaus.org/mojo</url>
</scm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ assert 1 == originalProject.repositories.size()
assert 1 == originalProject.prerequisites.size()
assert 1 == originalProject.properties.size()
assert 1 == originalProject.reporting.size()
assert 1 == originalProject.reports.size()
assert 1 == originalProject.scm.size()
assert 1 == originalProject.url.size()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.File;
import java.util.List;

import org.apache.maven.model.Dependency;
import org.apache.maven.model.Parent;
import org.apache.maven.model.Repository;
import org.apache.maven.model.building.FileModelSource;
Expand Down Expand Up @@ -171,6 +172,44 @@ public ModelSource resolveModel(Parent parent) throws UnresolvableModelException
return resolveModel(parent.getGroupId(), parent.getArtifactId(), parent.getVersion());
}

@Override
public ModelSource resolveModel(Dependency dependency) throws UnresolvableModelException {
Artifact artifact = new DefaultArtifact(
dependency.getGroupId(), dependency.getArtifactId(), "", "pom", dependency.getVersion());

VersionRangeRequest versionRangeRequest = new VersionRangeRequest(artifact, repositories, context);
versionRangeRequest.setTrace(trace);

try {
VersionRangeResult versionRangeResult = repositorySystem.resolveVersionRange(session, versionRangeRequest);

if (versionRangeResult.getHighestVersion() == null) {
throw new UnresolvableModelException(
"No versions matched the requested range '" + dependency.getVersion() + "'",
dependency.getGroupId(),
dependency.getArtifactId(),
dependency.getVersion());
}

if (versionRangeResult.getVersionConstraint() != null
&& versionRangeResult.getVersionConstraint().getRange() != null
&& versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null) {
throw new UnresolvableModelException(
"The requested version range '" + dependency.getVersion() + "' does not specify an upper bound",
dependency.getGroupId(),
dependency.getArtifactId(),
dependency.getVersion());
}

dependency.setVersion(versionRangeResult.getHighestVersion().toString());
} catch (VersionRangeResolutionException e) {
throw new UnresolvableModelException(
e.getMessage(), dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), e);
}

return resolveModel(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion());
}

/**
* @param repository The repository to add to the internal search chain, must not be {@code null}.
* @param replace {true} when repository with same id should be replaced, otherwise {@code false}.
Expand Down