From d80c9a5cda1dd5edb57b9d2590cdc67caae8fb36 Mon Sep 17 00:00:00 2001 From: Andrzej Jarmoniuk Date: Sat, 5 Nov 2022 08:15:56 +0100 Subject: [PATCH] Resolves #809: Extract the apis and common services to a separate module --- pom.xml | 1 + versions-api/pom.xml | 123 ++++++++++ .../versions/api/AbstractVersionDetails.java | 0 .../versions/api/ArtifactAssociation.java | 0 .../mojo/versions/api/ArtifactVersions.java | 0 .../versions/api/ArtifactVersionsCache.java | 0 .../api/DefaultArtifactAssociation.java | 0 .../versions/api/DefaultVersionsHelper.java | 2 - .../versions/api}/PluginUpdatesDetails.java | 3 +- .../codehaus/mojo/versions/api/PomHelper.java | 0 .../codehaus/mojo/versions/api}/Property.java | 2 +- .../mojo/versions/api/PropertyVersions.java | 1 - .../versions/api/PropertyVersionsBuilder.java | 0 .../mojo/versions/api/ReportRenderer.java | 0 .../codehaus/mojo/versions/api/Segment.java | 0 .../mojo/versions/api/VersionDetails.java | 0 .../mojo/versions/api/VersionsHelper.java | 8 +- .../change/AbstractVersionChanger.java | 0 .../change/CompositeVersionChanger.java | 0 .../change/DependencyVersionChanger.java | 0 .../versions/change/ParentVersionChanger.java | 0 .../versions/change/PluginVersionChanger.java | 0 .../change/ProjectVersionChanger.java | 0 .../mojo/versions/change/VersionChange.java | 0 .../mojo/versions/change/VersionChanger.java | 0 .../change/VersionChangerFactory.java | 0 .../versions/filtering/DependencyFilter.java | 0 .../filtering/NullAwareWildcardMatcher.java | 0 .../versions/filtering/TokenizedMatcher.java | 0 .../versions/filtering/WildcardMatcher.java | 0 .../ordering/AbstractVersionComparator.java | 0 .../ordering/BoundArtifactVersion.java | 0 .../versions/ordering/ComparableVersion.java | 0 .../ordering/InvalidSegmentException.java | 0 .../ordering/MavenVersionComparator.java | 0 .../ordering/MercuryVersionComparator.java | 0 .../ordering/NumericVersionComparator.java | 0 .../ordering/ReactorDepthComparator.java | 0 .../versions/ordering/VersionComparator.java | 0 .../versions/ordering/VersionComparators.java | 0 .../versions/recording/ChangeRecorder.java | 0 .../recording/ChangeRecorderNull.java | 0 .../versions/recording/ChangeRecorderXML.java | 0 .../rewriting/ModifiedPomXMLEventReader.java | 0 .../mojo/versions/utils/ContextualLog.java | 0 .../utils/DelegatingContextualLog.java | 0 .../versions/utils/DependencyBuilder.java | 0 .../versions/utils/DependencyComparator.java | 0 .../mojo/versions/utils/MiscUtils.java | 0 .../mojo/versions/utils/PluginComparator.java | 0 .../utils/PropertiesVersionsFileReader.java | 40 +++- .../versions/utils/PropertyComparator.java | 2 +- .../mojo/versions/utils/RegexUtils.java | 0 .../mojo/versions/utils/SegmentUtils.java | 0 .../utils/VersionsExpressionEvaluator.java | 0 .../mojo/versions/utils/WagonUtils.java | 0 .../versions/api/ArtifactVersionsTest.java | 0 .../api/DefaultVersionsHelperTest.java | 1 - .../mojo/versions/api/PomHelperTest.java | 30 ++- .../filtering/DependencyFilterTest.java | 89 ++++--- .../versions/filtering}/HasGAVMatcher.java | 21 +- .../filtering/TokenizedMatcherTest.java | 0 .../filtering/WildcardMatcherTest.java | 0 .../ordering/BoundArtifactVersionTest.java | 18 +- .../ordering/MavenVersionComparatorTest.java | 21 +- .../MercuryVersionComparatorTest.java | 15 +- .../NumericVersionComparatorTest.java | 0 .../ordering/VersionComparatorTestBase.java | 100 ++++++++ .../recording/ChangeRecorderXMLTest.java | 0 .../ModifiedPomXMLEventReaderTest.java | 0 .../utils/ModifiedPomXMLEventReaderUtils.java | 0 .../PropertiesVersionsFileReaderTest.java | 0 .../mojo/versions/utils/SegmentUtilsTest.java | 0 ...elperTest.dependencyManagementBOMs.pom.xml | 0 .../PomHelperTest.noGroupIdOnChild.pom.xml | 0 .../PomHelperTest.testLongProperties.pom.xml | 0 .../api/issue-505/moduleA/moduleA.xml | 0 .../api/issue-505/moduleA/moduleB/pom.xml | 0 .../mojo/versions/api/issue-505/pom.xml | 0 .../org/codehaus/mojo/versions/api/rules.xml | 0 .../mojo/versions/recording/expectedFile.xml | 0 .../testPropertiesVersionsFile.properties | 0 versions-maven-plugin/pom.xml | 24 +- .../versions/AbstractVersionsUpdaterMojo.java | 1 + .../versions/CompareDependenciesMojo.java | 1 + .../versions/DisplayPropertyUpdatesMojo.java | 1 + .../org/codehaus/mojo/versions/LinkItem.java | 222 ------------------ .../versions/PluginUpdatesReportMojo.java | 1 + .../versions/PropertyUpdatesReportMojo.java | 1 + .../mojo/versions/ResolveRangesMojo.java | 1 + .../mojo/versions/SetPropertyMojo.java | 1 + .../mojo/versions/UpdatePropertiesMojo.java | 1 + .../mojo/versions/UpdatePropertyMojo.java | 1 + .../reporting/PluginOverviewStats.java | 4 +- .../PluginUpdatesReportRenderer.java | 2 +- .../PropertyUpdatesReportRenderer.java | 2 +- .../reporting/model/PluginUpdatesModel.java | 7 +- .../reporting/model/PropertyUpdatesModel.java | 2 +- .../xml/PluginUpdatesXmlReportRenderer.java | 2 +- .../xml/PropertyUpdatesXmlReportRenderer.java | 2 +- .../PluginUpdatesXmlRendererTest.java | 1 + .../ordering/VersionComparatorTestBase.java | 100 -------- 102 files changed, 427 insertions(+), 427 deletions(-) create mode 100644 versions-api/pom.xml rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/ArtifactAssociation.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersions.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersionsCache.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/DefaultArtifactAssociation.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java (99%) rename {versions-maven-plugin/src/main/java/org/codehaus/mojo/versions => versions-api/src/main/java/org/codehaus/mojo/versions/api}/PluginUpdatesDetails.java (96%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java (100%) rename {versions-maven-plugin/src/main/java/org/codehaus/mojo/versions => versions-api/src/main/java/org/codehaus/mojo/versions/api}/Property.java (99%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java (99%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/PropertyVersionsBuilder.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/ReportRenderer.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/Segment.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java (97%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/CompositeVersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/ParentVersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/PluginVersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/ProjectVersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/VersionChange.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/VersionChanger.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/change/VersionChangerFactory.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/filtering/TokenizedMatcher.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/filtering/WildcardMatcher.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/AbstractVersionComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/ComparableVersion.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/InvalidSegmentException.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/MavenVersionComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/NumericVersionComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/ReactorDepthComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparators.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorder.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderNull.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderXML.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReader.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/ContextualLog.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/DelegatingContextualLog.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/DependencyBuilder.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/DependencyComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/MiscUtils.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/PluginComparator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java (53%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java (97%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/RegexUtils.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/VersionsExpressionEvaluator.java (100%) rename {versions-maven-plugin => versions-api}/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/api/ArtifactVersionsTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java (99%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java (89%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java (63%) rename {versions-maven-plugin/src/test/java/org/codehaus/mojo/versions => versions-api/src/test/java/org/codehaus/mojo/versions/filtering}/HasGAVMatcher.java (62%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/filtering/TokenizedMatcherTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/filtering/WildcardMatcherTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java (83%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java (73%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java (65%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java (100%) create mode 100644 versions-api/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/recording/ChangeRecorderXMLTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReaderTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/utils/ModifiedPomXMLEventReaderUtils.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/java/org/codehaus/mojo/versions/utils/SegmentUtilsTest.java (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.dependencyManagementBOMs.pom.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.noGroupIdOnChild.pom.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.testLongProperties.pom.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleA.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleB/pom.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/issue-505/pom.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/api/rules.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/recording/expectedFile.xml (100%) rename {versions-maven-plugin => versions-api}/src/test/resources/org/codehaus/mojo/versions/utils/testPropertiesVersionsFile.properties (100%) delete mode 100644 versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LinkItem.java delete mode 100644 versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java diff --git a/pom.xml b/pom.xml index 3b9a9f2c85..5820fdecd6 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,7 @@ versions-maven-plugin model-ruleset model-report + versions-api diff --git a/versions-api/pom.xml b/versions-api/pom.xml new file mode 100644 index 0000000000..0d39d91d27 --- /dev/null +++ b/versions-api/pom.xml @@ -0,0 +1,123 @@ + + + + versions + org.codehaus.mojo.versions + 2.14.0-SNAPSHOT + + 4.0.0 + + versions-api + + Versions API + API for Versions Maven Plugin + + + + org.codehaus.mojo.versions + model-ruleset + ${project.version} + + + + org.apache.maven + maven-artifact + ${mavenVersion} + provided + + + + org.apache.maven + maven-core + ${mavenVersion} + provided + + + org.apache.maven + maven-compat + ${mavenVersion} + provided + + + org.apache.maven + maven-model + ${mavenVersion} + provided + + + org.apache.maven + maven-plugin-api + ${mavenVersion} + provided + + + org.apache.maven + maven-settings + ${mavenVersion} + provided + + + org.apache.maven.wagon + wagon-provider-api + ${wagonVersion} + provided + + + + com.fasterxml.woodstox + woodstox-core + test + + + + org.apache.maven.wagon + wagon-file + ${wagonVersion} + test + + + org.apache.commons + commons-lang3 + + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + test + + + org.junit.jupiter + junit-jupiter + test + + + org.junit.vintage + junit-vintage-engine + test + + + org.hamcrest + hamcrest-core + + + + + org.mockito + mockito-inline + test + + + org.hamcrest + hamcrest + test + + + org.slf4j + slf4j-simple + test + + + + \ No newline at end of file diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ArtifactAssociation.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/ArtifactAssociation.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ArtifactAssociation.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/ArtifactAssociation.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersions.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersions.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersions.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersions.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersionsCache.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersionsCache.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersionsCache.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/ArtifactVersionsCache.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/DefaultArtifactAssociation.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/DefaultArtifactAssociation.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/DefaultArtifactAssociation.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/DefaultArtifactAssociation.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java similarity index 99% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java index a4d6d3f7fe..4f425ff300 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/api/DefaultVersionsHelper.java @@ -74,8 +74,6 @@ import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.authentication.AuthenticationException; import org.apache.maven.wagon.authorization.AuthorizationException; -import org.codehaus.mojo.versions.PluginUpdatesDetails; -import org.codehaus.mojo.versions.Property; import org.codehaus.mojo.versions.model.IgnoreVersion; import org.codehaus.mojo.versions.model.Rule; import org.codehaus.mojo.versions.model.RuleSet; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesDetails.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/PluginUpdatesDetails.java similarity index 96% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesDetails.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/PluginUpdatesDetails.java index 84842b57ef..6376f5c2d6 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesDetails.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/api/PluginUpdatesDetails.java @@ -1,4 +1,4 @@ -package org.codehaus.mojo.versions; +package org.codehaus.mojo.versions.api; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -24,7 +24,6 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.model.Dependency; -import org.codehaus.mojo.versions.api.ArtifactVersions; import static java.util.Optional.empty; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/Property.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/Property.java similarity index 99% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/Property.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/Property.java index d270f38cc1..09b5f56125 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/Property.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/api/Property.java @@ -1,4 +1,4 @@ -package org.codehaus.mojo.versions; +package org.codehaus.mojo.versions.api; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java similarity index 99% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java index fb4867604d..119e6192c3 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java @@ -40,7 +40,6 @@ import org.apache.maven.artifact.versioning.Restriction; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.project.MavenProject; -import org.codehaus.mojo.versions.Property; import org.codehaus.mojo.versions.ordering.BoundArtifactVersion; import org.codehaus.mojo.versions.ordering.InvalidSegmentException; import org.codehaus.mojo.versions.ordering.VersionComparator; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PropertyVersionsBuilder.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/PropertyVersionsBuilder.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PropertyVersionsBuilder.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/PropertyVersionsBuilder.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ReportRenderer.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/ReportRenderer.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/ReportRenderer.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/ReportRenderer.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/Segment.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/Segment.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/Segment.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/Segment.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java b/versions-api/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java similarity index 97% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java index beabeabd5e..bd803639d6 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java @@ -34,8 +34,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; -import org.codehaus.mojo.versions.PluginUpdatesDetails; -import org.codehaus.mojo.versions.Property; import org.codehaus.mojo.versions.ordering.VersionComparator; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; @@ -188,7 +186,7 @@ ArtifactVersions lookupDependencyUpdates( Dependency dependency, boolean usePlug * * @param plugins The set of {@link Plugin} instances to look up. * @param allowSnapshots Include snapshots in the list of updates. - * @return A map, keyed by plugin, with values of type {@link org.codehaus.mojo.versions.PluginUpdatesDetails}. + * @return A map, keyed by plugin, with values of type {@link org.codehaus.mojo.versions.api.PluginUpdatesDetails}. * @throws ArtifactMetadataRetrievalException When things go wrong. * @since 1.0-beta-1 */ @@ -218,12 +216,12 @@ PluginUpdatesDetails lookupPluginUpdates( Plugin plugin, boolean allowSnapshots /** * Returns a map of {@link org.codehaus.mojo.versions.api.PropertyVersions} values keyed by - * {@link org.codehaus.mojo.versions.Property} instances consisting of the properties defined in the project which + * {@link Property} instances consisting of the properties defined in the project which * are associated with version information. * * @param request {@link VersionPropertiesMapRequest} instance containing the arguments * @return a map of {@link org.codehaus.mojo.versions.api.PropertyVersions} values keyed by - * {@link org.codehaus.mojo.versions.Property} instances. + * {@link Property} instances. * @throws MojoExecutionException if something goes wrong. */ Map getVersionPropertiesMap( VersionPropertiesMapRequest request ) diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/CompositeVersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/CompositeVersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/CompositeVersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/CompositeVersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/ParentVersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/ParentVersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/ParentVersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/ParentVersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/PluginVersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/PluginVersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/PluginVersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/PluginVersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/ProjectVersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/ProjectVersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/ProjectVersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/ProjectVersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/VersionChange.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/VersionChange.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/VersionChange.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/VersionChange.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/VersionChanger.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/VersionChanger.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/VersionChanger.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/VersionChanger.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/VersionChangerFactory.java b/versions-api/src/main/java/org/codehaus/mojo/versions/change/VersionChangerFactory.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/change/VersionChangerFactory.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/change/VersionChangerFactory.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java b/versions-api/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java b/versions-api/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/TokenizedMatcher.java b/versions-api/src/main/java/org/codehaus/mojo/versions/filtering/TokenizedMatcher.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/TokenizedMatcher.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/filtering/TokenizedMatcher.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/WildcardMatcher.java b/versions-api/src/main/java/org/codehaus/mojo/versions/filtering/WildcardMatcher.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/WildcardMatcher.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/filtering/WildcardMatcher.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/AbstractVersionComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/AbstractVersionComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/AbstractVersionComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/AbstractVersionComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/ComparableVersion.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/ComparableVersion.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/ComparableVersion.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/ComparableVersion.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/InvalidSegmentException.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/InvalidSegmentException.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/InvalidSegmentException.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/InvalidSegmentException.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/MavenVersionComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/MavenVersionComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/MavenVersionComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/MavenVersionComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/NumericVersionComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/NumericVersionComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/NumericVersionComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/NumericVersionComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/ReactorDepthComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/ReactorDepthComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/ReactorDepthComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/ReactorDepthComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparators.java b/versions-api/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparators.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparators.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/ordering/VersionComparators.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorder.java b/versions-api/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorder.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorder.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorder.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderNull.java b/versions-api/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderNull.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderNull.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderNull.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderXML.java b/versions-api/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderXML.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderXML.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderXML.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReader.java b/versions-api/src/main/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReader.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReader.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReader.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/ContextualLog.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/ContextualLog.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/ContextualLog.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/ContextualLog.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/DelegatingContextualLog.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/DelegatingContextualLog.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/DelegatingContextualLog.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/DelegatingContextualLog.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/DependencyBuilder.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/DependencyBuilder.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/DependencyBuilder.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/DependencyBuilder.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/DependencyComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/DependencyComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/DependencyComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/DependencyComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/MiscUtils.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/MiscUtils.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/MiscUtils.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/MiscUtils.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PluginComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/PluginComparator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PluginComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/PluginComparator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java similarity index 53% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java index 98fcaa40a9..95dc0b654a 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReader.java @@ -1,5 +1,24 @@ package org.codehaus.mojo.versions.utils; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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. + */ + import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; @@ -9,8 +28,11 @@ import java.util.Properties; import java.util.stream.Collectors; -import org.codehaus.mojo.versions.Property; +import org.codehaus.mojo.versions.api.Property; +/** + * Reader class for reading property files + */ public class PropertiesVersionsFileReader { @@ -23,11 +45,19 @@ public class PropertiesVersionsFileReader private String propertyFilePath; + /** + * Creates an instance of the object with the given path to the property file + * @param filePath path to the property file + */ public PropertiesVersionsFileReader( String filePath ) { propertyFilePath = filePath; } + /** + * Reads the property file + * @throws IOException thrown if an I/O exception occurs during the read operation + */ public void read() throws IOException { try ( InputStream input = Files.newInputStream( Paths.get( propertyFilePath ) ) ) @@ -55,11 +85,19 @@ public void read() throws IOException } } + /** + * Returns the string contents of the property file + * @return contents of the property file + */ public String getProperties() { return propertiesCsv; } + /** + * Returns the array of {@link Property} objects + * @return array of properties + */ public Property[] getPropertiesConfig() { return propertiesConfig; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java similarity index 97% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java index 676df82494..8459950159 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java +++ b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/PropertyComparator.java @@ -22,7 +22,7 @@ import java.util.Comparator; import org.apache.commons.lang3.StringUtils; -import org.codehaus.mojo.versions.Property; +import org.codehaus.mojo.versions.api.Property; /** * A comparator used to sort {@link Property} instances. diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/RegexUtils.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/RegexUtils.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/RegexUtils.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/RegexUtils.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/VersionsExpressionEvaluator.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/VersionsExpressionEvaluator.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/VersionsExpressionEvaluator.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/VersionsExpressionEvaluator.java diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java b/versions-api/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java similarity index 100% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java rename to versions-api/src/main/java/org/codehaus/mojo/versions/utils/WagonUtils.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/ArtifactVersionsTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/api/ArtifactVersionsTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/ArtifactVersionsTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/api/ArtifactVersionsTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java similarity index 99% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java index 0ccf473e9f..047bc3f421 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/api/DefaultVersionsHelperTest.java @@ -44,7 +44,6 @@ import org.apache.maven.project.artifact.MavenMetadataSource; import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.Settings; -import org.codehaus.mojo.versions.Property; import org.codehaus.mojo.versions.model.IgnoreVersion; import org.codehaus.mojo.versions.model.Rule; import org.codehaus.mojo.versions.model.RuleSet; diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java similarity index 89% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java index 9e472005f3..460883f855 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/api/PomHelperTest.java @@ -1,5 +1,24 @@ package org.codehaus.mojo.versions.api; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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. + */ + import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; @@ -18,6 +37,7 @@ import org.apache.maven.project.MavenProject; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import org.codehaus.stax2.XMLInputFactory2; +import org.hamcrest.MatcherAssert; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; @@ -218,7 +238,7 @@ public void testSetElementValueExistingValue() throws XMLStreamException assertThat( PomHelper.setElementValue( xmlEventReader, "/super-parent/parent", "child", "value" ), is( true ) ); - assertThat( xmlEventReader, + MatcherAssert.assertThat( xmlEventReader, matches( "value" ) ); } @@ -230,7 +250,7 @@ public void testSetElementValueEmptyChild() throws XMLStreamException assertThat( PomHelper.setElementValue( xmlEventReader, "/super-parent/parent", "child", "value" ), is( true ) ); - assertThat( xmlEventReader, + MatcherAssert.assertThat( xmlEventReader, matches( "value" ) ); } @@ -242,7 +262,7 @@ public void testSetElementValueNewValueEmptyParent() throws XMLStreamException assertThat( PomHelper.setElementValue( xmlEventReader, "/super-parent/parent", "child", "value" ), is( true ) ); - assertThat( xmlEventReader, + MatcherAssert.assertThat( xmlEventReader, matches( "value" ) ); } @@ -254,7 +274,7 @@ public void testSetElementValueNewValueNoChild() throws XMLStreamException assertThat( PomHelper.setElementValue( xmlEventReader, "/super-parent/parent", "child", "value" ), is( true ) ); - assertThat( xmlEventReader, + MatcherAssert.assertThat( xmlEventReader, matches( "value" ) ); } @@ -267,7 +287,7 @@ public void testSetProjectValueNewValueNonEmptyParent() throws XMLStreamExceptio assertThat( PomHelper.setElementValue( xmlEventReader, "/super-parent/parent", "child", "value" ), is( true ) ); - assertThat( xmlEventReader, + MatcherAssert.assertThat( xmlEventReader, matches( "value" ) ); } diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java similarity index 63% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java index 956facfb62..422323bebd 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/filtering/DependencyFilterTest.java @@ -1,18 +1,37 @@ package org.codehaus.mojo.versions.filtering; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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. + */ + import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.apache.maven.model.Dependency; import org.codehaus.mojo.versions.utils.DependencyBuilder; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import static java.util.Arrays.asList; -import static org.codehaus.mojo.versions.HasGAVMatcher.hasGAV; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.empty; class DependencyFilterTest @@ -35,11 +54,11 @@ void removesExcludedDepsWithExactMatch() Set actual = exclusions.removingFrom( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "foo", "bar", "1" ), - hasGAV( "localhost", "my-api", "2" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "foo", "bar", "1" ), + HasGAVMatcher.hasGAV( "localhost", "my-api", "2" ) ) ); } @@ -52,11 +71,11 @@ void removesExcludedDepsWithWildcardInVersion() Set actual = exclusions.removingFrom( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "foo", "bar", "1" ), - hasGAV( "localhost", "my-api", "2" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "foo", "bar", "1" ), + HasGAVMatcher.hasGAV( "localhost", "my-api", "2" ) ) ); } @@ -68,10 +87,10 @@ void removesExcludedDepsWithWildcardInGroupId() Set actual = exclusions.removingFrom( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "foo", "bar", "1" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "foo", "bar", "1" ) ) ); } @@ -99,10 +118,10 @@ void removesMultiplePatterns() Set actual = exclusions.removingFrom( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "foo", "bar", "1" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "foo", "bar", "1" ) ) ); } @@ -126,10 +145,10 @@ void retainsOnlyDepsWithExactMatch() Set actual = exclusions.retainingIn( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "localhost", "my-impl", "3" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "localhost", "my-impl", "3" ) ) ); } @@ -142,10 +161,10 @@ void retainsOnlyDepsMatchingWildcardInVersion() Set actual = exclusions.retainingIn( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "localhost", "my-api", "2" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "localhost", "my-api", "2" ) ) ); } @@ -157,11 +176,11 @@ void retainsOnlyDepsWithMultipleWildcards() Set actual = exclusions.retainingIn( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "localhost", "my-api", "2" ), - hasGAV( "localhost", "my-impl", "3" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "localhost", "my-api", "2" ), + HasGAVMatcher.hasGAV( "localhost", "my-impl", "3" ) ) ); } @@ -173,12 +192,12 @@ void retainsAllOnAllWildcards() Set actual = exclusions.retainingIn( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "foo", "bar", "1" ), - hasGAV( "localhost", "my-api", "2" ), - hasGAV( "localhost", "my-impl", "3" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "foo", "bar", "1" ), + HasGAVMatcher.hasGAV( "localhost", "my-api", "2" ), + HasGAVMatcher.hasGAV( "localhost", "my-impl", "3" ) ) ); } @@ -194,11 +213,11 @@ void retainsMultiplePatterns() Set actual = exclusions.retainingIn( input ); - assertThat( + MatcherAssert.assertThat( actual, - containsInAnyOrder( - hasGAV( "localhost", "my-api", "2" ), - hasGAV( "localhost", "my-impl", "3" ) + Matchers.containsInAnyOrder( + HasGAVMatcher.hasGAV( "localhost", "my-api", "2" ), + HasGAVMatcher.hasGAV( "localhost", "my-impl", "3" ) ) ); } diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/HasGAVMatcher.java b/versions-api/src/test/java/org/codehaus/mojo/versions/filtering/HasGAVMatcher.java similarity index 62% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/HasGAVMatcher.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/filtering/HasGAVMatcher.java index dda261a64f..e9dd54321f 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/HasGAVMatcher.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/filtering/HasGAVMatcher.java @@ -1,4 +1,23 @@ -package org.codehaus.mojo.versions; +package org.codehaus.mojo.versions.filtering; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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. + */ import java.util.Objects; diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/TokenizedMatcherTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/filtering/TokenizedMatcherTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/TokenizedMatcherTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/filtering/TokenizedMatcherTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/WildcardMatcherTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/filtering/WildcardMatcherTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/filtering/WildcardMatcherTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/filtering/WildcardMatcherTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java similarity index 83% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java index d62e972303..24367c06b0 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java @@ -21,9 +21,9 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.codehaus.mojo.versions.api.Segment; +import org.hamcrest.MatcherAssert; import org.junit.Test; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.lessThan; @@ -38,7 +38,7 @@ public void testMajorUpperBoundGreaterThanNextMajor() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.2.3" ), Segment.MAJOR ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "2.0.0" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @Test @@ -47,7 +47,7 @@ public void testSubIncrementalUpperBoundGreaterThanNextSubIncremental() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.2.3-2" ), Segment.SUBINCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.2.3-3" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @Test @@ -56,7 +56,7 @@ public void testVersionShorterThanSegment() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), Segment.INCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.3" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @Test @@ -65,7 +65,7 @@ public void testVersionBoundArtifactVersionShorterThanConcreteVersionAndSegment( BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), Segment.SUBINCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.3" ); - assertThat( bound.compareTo( artifactVersion ), lessThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), lessThan( 0 ) ); } @Test @@ -74,7 +74,7 @@ public void testVersionSubIncrementalBoundGreaterThanSubIncremental() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), Segment.SUBINCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.0-2" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @Test @@ -83,7 +83,7 @@ public void testVersionSubIncrementalBoundGreaterThanIncremental() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), Segment.INCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.3" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @Test @@ -92,7 +92,7 @@ public void testVersionSubIncrementalBoundGreaterThanMinor() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), Segment.MINOR ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.3" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @Test @@ -101,6 +101,6 @@ public void testSnapshotWithSubIncremental() BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.0.0-SNAPSHOT" ), Segment.MINOR ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.0.0" ); - assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); + MatcherAssert.assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } } diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java similarity index 73% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java index 452ef34786..45a958bbf0 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java @@ -20,6 +20,8 @@ */ import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.hamcrest.MatcherAssert; +import org.hamcrest.core.Is; import org.junit.Test; import static org.codehaus.mojo.versions.api.Segment.INCREMENTAL; @@ -27,7 +29,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.lessThan; -import static org.hamcrest.core.Is.is; public class MavenVersionComparatorTest extends VersionComparatorTestBase { @@ -39,32 +40,32 @@ public MavenVersionComparatorTest() @Test public void testSegmentCounting() { - assertThat( 3, is( instance.getSegmentCount( version( "5" ) ) ) ); - assertThat( 3, is( instance.getSegmentCount( version( "5.0" ) ) ) ); - assertThat( 4, is( instance.getSegmentCount( version( "5-0" ) ) ) ); - assertThat( 1, is( instance.getSegmentCount( version( "5.3.a" ) ) ) ); - assertThat( 1, is( instance.getSegmentCount( version( "5.0.a.1.4.5" ) ) ) ); - assertThat( 3, is( instance.getSegmentCount( version( "" ) ) ) ); + MatcherAssert.assertThat( 3, Is.is( instance.getSegmentCount( version( "5" ) ) ) ); + MatcherAssert.assertThat( 3, Is.is( instance.getSegmentCount( version( "5.0" ) ) ) ); + MatcherAssert.assertThat( 4, Is.is( instance.getSegmentCount( version( "5-0" ) ) ) ); + MatcherAssert.assertThat( 1, Is.is( instance.getSegmentCount( version( "5.3.a" ) ) ) ); + MatcherAssert.assertThat( 1, Is.is( instance.getSegmentCount( version( "5.0.a.1.4.5" ) ) ) ); + MatcherAssert.assertThat( 3, Is.is( instance.getSegmentCount( version( "" ) ) ) ); } @Test public void testUpperBoundaryCustom() { - assertThat( instance.compare( new BoundArtifactVersion( version( "1.2.3" ), + MatcherAssert.assertThat( instance.compare( new BoundArtifactVersion( version( "1.2.3" ), INCREMENTAL ), version( "1.2.3-ANDRZEJ" ) ), greaterThan( 0 ) ); } @Test public void testUpperBoundaryRelease() { - assertThat( instance.compare( new BoundArtifactVersion( version( "1.1.0" ), + MatcherAssert.assertThat( instance.compare( new BoundArtifactVersion( version( "1.1.0" ), INCREMENTAL ), version( "1.1.0" ) ), greaterThan( 0 ) ); } @Test public void testUpperBoundarySnapshot() { - assertThat( instance.compare( new BoundArtifactVersion( version( "1.1.0" ), + MatcherAssert.assertThat( instance.compare( new BoundArtifactVersion( version( "1.1.0" ), INCREMENTAL ), version( "1.1.0-SNAPSHOT" ) ), greaterThan( 0 ) ); } diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java similarity index 65% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java index 9af7bbc4c6..85783ee255 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java @@ -20,10 +20,9 @@ */ import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.junit.Assert; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class MercuryVersionComparatorTest extends VersionComparatorTestBase { public MercuryVersionComparatorTest() @@ -34,12 +33,12 @@ public MercuryVersionComparatorTest() @Test public void testSegmentCounting() { - assertEquals( 1, instance.getSegmentCount( new DefaultArtifactVersion( "5" ) ) ); - assertEquals( 2, instance.getSegmentCount( new DefaultArtifactVersion( "5.0" ) ) ); - assertEquals( 2, instance.getSegmentCount( new DefaultArtifactVersion( "5-0" ) ) ); - assertEquals( 3, instance.getSegmentCount( new DefaultArtifactVersion( "5.3.a" ) ) ); - assertEquals( 6, instance.getSegmentCount( new DefaultArtifactVersion( "5.0.a.1.4.5" ) ) ); - assertEquals( 0, instance.getSegmentCount( new DefaultArtifactVersion( "" ) ) ); + Assert.assertEquals( 1, instance.getSegmentCount( new DefaultArtifactVersion( "5" ) ) ); + Assert.assertEquals( 2, instance.getSegmentCount( new DefaultArtifactVersion( "5.0" ) ) ); + Assert.assertEquals( 2, instance.getSegmentCount( new DefaultArtifactVersion( "5-0" ) ) ); + Assert.assertEquals( 3, instance.getSegmentCount( new DefaultArtifactVersion( "5.3.a" ) ) ); + Assert.assertEquals( 6, instance.getSegmentCount( new DefaultArtifactVersion( "5.0.a.1.4.5" ) ) ); + Assert.assertEquals( 0, instance.getSegmentCount( new DefaultArtifactVersion( "" ) ) ); } diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java diff --git a/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java new file mode 100644 index 0000000000..6ef9001478 --- /dev/null +++ b/versions-api/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java @@ -0,0 +1,100 @@ +package org.codehaus.mojo.versions.ordering; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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. + */ + +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.hamcrest.MatcherAssert; +import org.junit.Test; + +import static org.hamcrest.Matchers.lessThan; + +/** + * Abstract base class for {@link MavenVersionComparatorTest}, {@link MercuryVersionComparatorTest}, + * and {@link NumericVersionComparatorTest} + */ +public abstract class VersionComparatorTestBase +{ + protected final VersionComparator instance; + + public VersionComparatorTestBase( VersionComparator instance ) + { + this.instance = instance; + } + + protected static ArtifactVersion version( String version ) + { + return new DefaultArtifactVersion( version ); + } + + @Test + public void testVersionComparatorRow1() + { + MatcherAssert.assertThat( instance.compare( version( "1" ), version( "2" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0" ), version( "2.0" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0" ), version( "1.1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0" ), version( "1.1" ) ), lessThan( 0 ) ); + } + + @Test + public void testVersionComparatorRow2() + { + MatcherAssert.assertThat( instance.compare( version( "1.0" ), version( "2.0" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0" ), version( "1.1" ) ), lessThan( 0 ) ); + } + + @Test + public void testVersionComparatorRow3() + { + MatcherAssert.assertThat( instance.compare( version( "1.0.0" ), version( "2.0.0" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0" ), version( "1.1.0" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0" ), version( "1.0.1" ) ), lessThan( 0 ) ); + } + + @Test + public void testVersionComparatorRow4() + { + MatcherAssert.assertThat( instance.compare( version( "1.0.0-1" ), version( "2.0.0-1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0-1" ), version( "1.1.0-1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0-1" ), version( "1.0.1-1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0-1" ), version( "1.0.0-2" ) ), lessThan( 0 ) ); + } + + @Test + public void testVersionComparatorRow5() + { + MatcherAssert.assertThat( instance.compare( version( "1.0.0-sp1" ), version( "2.0.0-sp1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0-sp1" ), version( "1.1.0-sp1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0-sp1" ), version( "1.0.1-sp1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1.0.0-sp1" ), version( "1.0.0-1-sp1" ) ), lessThan( 0 ) ); + } + + @Test + public void testVersionComparatorRow6() + { + MatcherAssert.assertThat( instance.compare( version( "foobar" ), version( "foobar-1" ) ), lessThan( 0 ) ); + } + + @Test + public void testVersionComparatorRow7() + { + MatcherAssert.assertThat( instance.compare( version( "1-alpha-1" ), version( "2-alpha-1" ) ), lessThan( 0 ) ); + MatcherAssert.assertThat( instance.compare( version( "1-alpha-1" ), version( "1-alpha-2" ) ), lessThan( 0 ) ); + } +} diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/recording/ChangeRecorderXMLTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/recording/ChangeRecorderXMLTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/recording/ChangeRecorderXMLTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/recording/ChangeRecorderXMLTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReaderTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReaderTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReaderTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/rewriting/ModifiedPomXMLEventReaderTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/ModifiedPomXMLEventReaderUtils.java b/versions-api/src/test/java/org/codehaus/mojo/versions/utils/ModifiedPomXMLEventReaderUtils.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/ModifiedPomXMLEventReaderUtils.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/utils/ModifiedPomXMLEventReaderUtils.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/SegmentUtilsTest.java b/versions-api/src/test/java/org/codehaus/mojo/versions/utils/SegmentUtilsTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/SegmentUtilsTest.java rename to versions-api/src/test/java/org/codehaus/mojo/versions/utils/SegmentUtilsTest.java diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.dependencyManagementBOMs.pom.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.dependencyManagementBOMs.pom.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.dependencyManagementBOMs.pom.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.dependencyManagementBOMs.pom.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.noGroupIdOnChild.pom.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.noGroupIdOnChild.pom.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.noGroupIdOnChild.pom.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.noGroupIdOnChild.pom.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.testLongProperties.pom.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.testLongProperties.pom.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.testLongProperties.pom.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/PomHelperTest.testLongProperties.pom.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleA.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleA.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleA.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleA.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleB/pom.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleB/pom.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleB/pom.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/issue-505/moduleA/moduleB/pom.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/issue-505/pom.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/issue-505/pom.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/issue-505/pom.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/issue-505/pom.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/rules.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/api/rules.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/api/rules.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/api/rules.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/recording/expectedFile.xml b/versions-api/src/test/resources/org/codehaus/mojo/versions/recording/expectedFile.xml similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/recording/expectedFile.xml rename to versions-api/src/test/resources/org/codehaus/mojo/versions/recording/expectedFile.xml diff --git a/versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/utils/testPropertiesVersionsFile.properties b/versions-api/src/test/resources/org/codehaus/mojo/versions/utils/testPropertiesVersionsFile.properties similarity index 100% rename from versions-maven-plugin/src/test/resources/org/codehaus/mojo/versions/utils/testPropertiesVersionsFile.properties rename to versions-api/src/test/resources/org/codehaus/mojo/versions/utils/testPropertiesVersionsFile.properties diff --git a/versions-maven-plugin/pom.xml b/versions-maven-plugin/pom.xml index 7469b884e4..51afb6084b 100644 --- a/versions-maven-plugin/pom.xml +++ b/versions-maven-plugin/pom.xml @@ -27,6 +27,12 @@ ${project.version} + + org.codehaus.mojo.versions + versions-api + ${project.version} + + org.apache.maven.plugin-tools maven-plugin-annotations @@ -69,10 +75,6 @@ ${mavenVersion} provided - - org.apache.maven.reporting - maven-reporting-api - org.apache.maven.reporting maven-reporting-impl @@ -81,17 +83,7 @@ org.apache.maven.shared maven-common-artifact-filters - - org.apache.maven.wagon - wagon-provider-api - ${wagonVersion} - provided - - - org.apache.maven.wagon - wagon-file - ${wagonVersion} - + @@ -116,10 +108,12 @@ org.codehaus.plexus plexus-interactivity-api + com.fasterxml.woodstox woodstox-core + org.apache.commons commons-lang3 diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java index ca59f3755f..9a526ca644 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java @@ -55,6 +55,7 @@ import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.DefaultVersionsHelper; import org.codehaus.mojo.versions.api.PomHelper; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionsHelper; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java index eb7d80d8b7..807ebd4c36 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/CompareDependenciesMojo.java @@ -46,6 +46,7 @@ import org.apache.maven.repository.RepositorySystem; import org.codehaus.mojo.versions.api.ArtifactAssociation; import org.codehaus.mojo.versions.api.PomHelper; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.VersionsHelper; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java index f0f11a7a5a..65a183dc48 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayPropertyUpdatesMojo.java @@ -40,6 +40,7 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.repository.RepositorySystem; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionsHelper; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LinkItem.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LinkItem.java deleted file mode 100644 index 6f604dfc39..0000000000 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LinkItem.java +++ /dev/null @@ -1,222 +0,0 @@ -package org.codehaus.mojo.versions; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -/** - * LinkItem represents information specified for a linked artifact version manged through a property. - * - * @author Stephen Connolly - * @since 1.0-alpha-1 - */ -public class LinkItem -{ - - // ------------------------------ FIELDS ------------------------------ - - /** - * Group Id of the Artifact. - * - * @parameter - * @required - * @since 1.0-alpha-1 - */ - private String groupId; - - /** - * Artifact Id of the Artifact. - * - * @parameter - * @required - * @since 1.0-alpha-1 - */ - private String artifactId; - - /** - * The property that defines the version of the artifact to use. - * - * @parameter - * @required - * @since 1.0-alpha-1 - */ - private String property; - - /** - * Version specification to control artifact resolution. - * - * @parameter - * @since 1.0-alpha-1 - */ - private String version = null; - - /** - * Override snapshot permisibility. - * - * @parameter - * @since 1.0-alpha-1 - */ - private Boolean allowSnapshots = null; - - // --------------------------- CONSTRUCTORS --------------------------- - - /** - * Constructs a new LinkItem. - * - * @since 1.0-alpha-1 - */ - public LinkItem() - { - } - - // --------------------- GETTER / SETTER METHODS --------------------- - - /** - * Getter for property 'allowSnapshots'. - * - * @return Value for property 'allowSnapshots'. - * @since 1.0-alpha-1 - */ - public Boolean getAllowSnapshots() - { - return allowSnapshots; - } - - /** - * Setter for property 'allowSnapshots'. - * - * @param allowSnapshots Value to set for property 'allowSnapshots'. - * @since 1.0-alpha-1 - */ - public void setAllowSnapshots( Boolean allowSnapshots ) - { - this.allowSnapshots = allowSnapshots; - } - - /** - * Getter for property 'artifactId'. - * - * @return Value for property 'artifactId'. - * @since 1.0-alpha-1 - */ - public String getArtifactId() - { - return artifactId; - } - - /** - * Setter for property 'artifactId'. - * - * @param artifactId Value to set for property 'artifactId'. - * @since 1.0-alpha-1 - */ - public void setArtifactId( String artifactId ) - { - this.artifactId = artifactId; - } - - /** - * Getter for property 'groupId'. - * - * @return Value for property 'groupId'. - * @since 1.0-alpha-1 - */ - public String getGroupId() - { - return groupId; - } - - /** - * Setter for property 'groupId'. - * - * @param groupId Value to set for property 'groupId'. - * @since 1.0-alpha-1 - */ - public void setGroupId( String groupId ) - { - this.groupId = groupId; - } - - /** - * Getter for property 'property'. - * - * @return Value for property 'property'. - * @since 1.0-alpha-1 - */ - public String getProperty() - { - return property; - } - - /** - * Setter for property 'property'. - * - * @param property Value to set for property 'property'. - * @since 1.0-alpha-1 - */ - public void setProperty( String property ) - { - this.property = property; - } - - /** - * Getter for property 'version'. - * - * @return Value for property 'version'. - * @since 1.0-alpha-1 - */ - public String getVersion() - { - return version; - } - - /** - * Setter for property 'version'. - * - * @param version Value to set for property 'version'. - * @since 1.0-alpha-1 - */ - public void setVersion( String version ) - { - this.version = version; - } - - // ------------------------ CANONICAL METHODS ------------------------ - - /** - * {@inheritDoc} - * - * @since 1.0-alpha-1 - */ - public String toString() - { - StringBuilder buf = new StringBuilder( "${" ); - buf.append( property ); - buf.append( "} = " ); - buf.append( groupId ); - buf.append( ':' ); - buf.append( artifactId ); - if ( version != null ) - { - buf.append( ':' ); - buf.append( version ); - } - return buf.toString(); - } - -} diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java index 05b9bdbfe2..717dec32a1 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesReportMojo.java @@ -41,6 +41,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.reporting.ReportRendererFactory; import org.codehaus.mojo.versions.reporting.model.PluginUpdatesModel; import org.codehaus.mojo.versions.utils.PluginComparator; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java index 480949fefd..4469b1da37 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PropertyUpdatesReportMojo.java @@ -39,6 +39,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.repository.RepositorySystem; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.VersionsHelper; import org.codehaus.mojo.versions.reporting.ReportRendererFactory; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java index 5c05c8b083..7729cba15a 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java @@ -44,6 +44,7 @@ import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.repository.RepositorySystem; import org.codehaus.mojo.versions.api.PomHelper; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionsHelper; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java index da046d430d..f2e6787122 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/SetPropertyMojo.java @@ -36,6 +36,7 @@ import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.repository.RepositorySystem; import org.codehaus.mojo.versions.api.PomHelper; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.VersionsHelper; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java index bd692db5a3..8211e28179 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertiesMojo.java @@ -37,6 +37,7 @@ import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.repository.RepositorySystem; import org.codehaus.mojo.versions.api.ArtifactAssociation; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionsHelper; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java index ed9d279617..9e22942623 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UpdatePropertyMojo.java @@ -37,6 +37,7 @@ import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.repository.RepositorySystem; import org.codehaus.mojo.versions.api.ArtifactAssociation; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.api.Segment; import org.codehaus.mojo.versions.api.VersionsHelper; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginOverviewStats.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginOverviewStats.java index 81dea82dd6..25494f7869 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginOverviewStats.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginOverviewStats.java @@ -21,10 +21,10 @@ import java.util.Collection; import java.util.Optional; -import org.codehaus.mojo.versions.PluginUpdatesDetails; import org.codehaus.mojo.versions.api.AbstractVersionDetails; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.ArtifactVersionsCache; +import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.reporting.model.PluginUpdatesModel; import static java.util.Optional.of; @@ -58,7 +58,7 @@ public void incrementDependencies() * @param cache if not null, cache to retrieve the version information, initialised with * the {@link ArtifactVersions#getNewestUpdate(Optional)} update information * @param always equal to {@linkplain PluginOverviewStats} - * @param always equal to {@linkplain org.codehaus.mojo.versions.PluginUpdatesDetails} + * @param always equal to {@linkplain PluginUpdatesDetails} * @return instance of the {@linkplain PluginOverviewStats}, initialised with the update information */ public static diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java index 6d0713cd41..c878110a8c 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java @@ -29,8 +29,8 @@ import org.apache.maven.doxia.sink.SinkEventAttributes; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; import org.apache.maven.model.Dependency; -import org.codehaus.mojo.versions.PluginUpdatesDetails; import org.codehaus.mojo.versions.api.ArtifactVersions; +import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.reporting.model.PluginUpdatesModel; import org.codehaus.plexus.i18n.I18N; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java index 1ca1730906..c68656e6c6 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/PropertyUpdatesReportRenderer.java @@ -31,7 +31,7 @@ import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.SinkEventAttributes; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; -import org.codehaus.mojo.versions.Property; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.ArtifactAssociation; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.reporting.model.PropertyUpdatesModel; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PluginUpdatesModel.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PluginUpdatesModel.java index 1846624a53..fd3186aa27 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PluginUpdatesModel.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PluginUpdatesModel.java @@ -22,7 +22,7 @@ import java.util.Map; import org.apache.maven.model.Plugin; -import org.codehaus.mojo.versions.PluginUpdatesDetails; +import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.utils.DependencyBuilder; /** @@ -30,6 +30,11 @@ */ public class PluginUpdatesModel extends AbstractUpdatesModel { + /** + * Creates a new instance + * @param pluginUpdates map of plugin updates per plugin + * @param pluginManagementUpdates map of plugin management updates per plugin + */ public PluginUpdatesModel( Map pluginUpdates, Map pluginManagementUpdates ) { diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PropertyUpdatesModel.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PropertyUpdatesModel.java index 9a5d36cfc0..c2a6aa4606 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PropertyUpdatesModel.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/reporting/model/PropertyUpdatesModel.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.TreeMap; -import org.codehaus.mojo.versions.Property; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.PropertyVersions; import org.codehaus.mojo.versions.utils.PropertyComparator; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PluginUpdatesXmlReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PluginUpdatesXmlReportRenderer.java index fa04791c9a..42173d048b 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PluginUpdatesXmlReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PluginUpdatesXmlReportRenderer.java @@ -30,9 +30,9 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.model.Dependency; -import org.codehaus.mojo.versions.PluginUpdatesDetails; import org.codehaus.mojo.versions.api.AbstractVersionDetails; import org.codehaus.mojo.versions.api.ArtifactVersionsCache; +import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.api.ReportRenderer; import org.codehaus.mojo.versions.reporting.PluginOverviewStats; import org.codehaus.mojo.versions.reporting.model.PluginInfo; diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PropertyUpdatesXmlReportRenderer.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PropertyUpdatesXmlReportRenderer.java index a9d9c882ba..2042858614 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PropertyUpdatesXmlReportRenderer.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/xml/PropertyUpdatesXmlReportRenderer.java @@ -30,7 +30,7 @@ import java.util.stream.Collectors; import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.codehaus.mojo.versions.Property; +import org.codehaus.mojo.versions.api.Property; import org.codehaus.mojo.versions.api.AbstractVersionDetails; import org.codehaus.mojo.versions.api.ArtifactVersionsCache; import org.codehaus.mojo.versions.api.PropertyVersions; diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesXmlRendererTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesXmlRendererTest.java index f39a880cc9..a0b9cb2e15 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesXmlRendererTest.java +++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/PluginUpdatesXmlRendererTest.java @@ -29,6 +29,7 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.model.Plugin; import org.codehaus.mojo.versions.api.ArtifactVersions; +import org.codehaus.mojo.versions.api.PluginUpdatesDetails; import org.codehaus.mojo.versions.ordering.MavenVersionComparator; import org.codehaus.mojo.versions.reporting.model.PluginUpdatesModel; import org.codehaus.mojo.versions.utils.DependencyBuilder; diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java deleted file mode 100644 index 28e326a2ec..0000000000 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.codehaus.mojo.versions.ordering; -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ - -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.lessThan; - -/** - * Abstract base class for {@link MavenVersionComparatorTest}, {@link MercuryVersionComparatorTest}, - * and {@link NumericVersionComparatorTest} - */ -public abstract class VersionComparatorTestBase -{ - protected final VersionComparator instance; - - public VersionComparatorTestBase( VersionComparator instance ) - { - this.instance = instance; - } - - protected static ArtifactVersion version( String version ) - { - return new DefaultArtifactVersion( version ); - } - - @Test - public void testVersionComparatorRow1() - { - assertThat( instance.compare( version( "1" ), version( "2" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0" ), version( "2.0" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0" ), version( "1.1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0" ), version( "1.1" ) ), lessThan( 0 ) ); - } - - @Test - public void testVersionComparatorRow2() - { - assertThat( instance.compare( version( "1.0" ), version( "2.0" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0" ), version( "1.1" ) ), lessThan( 0 ) ); - } - - @Test - public void testVersionComparatorRow3() - { - assertThat( instance.compare( version( "1.0.0" ), version( "2.0.0" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0" ), version( "1.1.0" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0" ), version( "1.0.1" ) ), lessThan( 0 ) ); - } - - @Test - public void testVersionComparatorRow4() - { - assertThat( instance.compare( version( "1.0.0-1" ), version( "2.0.0-1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0-1" ), version( "1.1.0-1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0-1" ), version( "1.0.1-1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0-1" ), version( "1.0.0-2" ) ), lessThan( 0 ) ); - } - - @Test - public void testVersionComparatorRow5() - { - assertThat( instance.compare( version( "1.0.0-sp1" ), version( "2.0.0-sp1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0-sp1" ), version( "1.1.0-sp1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0-sp1" ), version( "1.0.1-sp1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1.0.0-sp1" ), version( "1.0.0-1-sp1" ) ), lessThan( 0 ) ); - } - - @Test - public void testVersionComparatorRow6() - { - assertThat( instance.compare( version( "foobar" ), version( "foobar-1" ) ), lessThan( 0 ) ); - } - - @Test - public void testVersionComparatorRow7() - { - assertThat( instance.compare( version( "1-alpha-1" ), version( "2-alpha-1" ) ), lessThan( 0 ) ); - assertThat( instance.compare( version( "1-alpha-1" ), version( "1-alpha-2" ) ), lessThan( 0 ) ); - } -}