diff --git a/pom.xml b/pom.xml index 3b9a9f2c85..d2955b8d05 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,7 @@ versions-maven-plugin model-ruleset model-report + versions-common diff --git a/versions-common/pom.xml b/versions-common/pom.xml new file mode 100644 index 0000000000..dffbe388bc --- /dev/null +++ b/versions-common/pom.xml @@ -0,0 +1,123 @@ + + + + versions + org.codehaus.mojo.versions + 2.14.0-SNAPSHOT + + 4.0.0 + + versions-common + + Versions Common + Common components for the 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 + + + + diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java b/versions-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java similarity index 70% rename from versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java rename to versions-common/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java index 07bf61617e..e31a0481a5 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/filtering/DependencyFilter.java @@ -1,5 +1,24 @@ 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.List; import java.util.Set; import java.util.TreeSet; diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java b/versions-common/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java new file mode 100644 index 0000000000..1db96c0d99 --- /dev/null +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java @@ -0,0 +1,41 @@ +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. + */ + +public class NullAwareWildcardMatcher extends WildcardMatcher +{ + public static final String NULL_KEYWORD = "null"; + + public NullAwareWildcardMatcher( String pattern ) + { + super( pattern ); + } + + @Override + public boolean test( String token ) + { + if ( NULL_KEYWORD.equals( getPattern() ) ) + { + return token == null; + } + + return super.test( token ); + } +} diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/TokenizedMatcher.java b/versions-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java similarity index 89% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java rename to versions-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java index d62e972303..32b4f3db14 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java +++ b/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java @@ -20,9 +20,12 @@ import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.codehaus.mojo.versions.api.Segment; import org.junit.Test; +import static org.codehaus.mojo.versions.api.Segment.INCREMENTAL; +import static org.codehaus.mojo.versions.api.Segment.MAJOR; +import static org.codehaus.mojo.versions.api.Segment.MINOR; +import static org.codehaus.mojo.versions.api.Segment.SUBINCREMENTAL; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.lessThan; @@ -36,7 +39,7 @@ public class BoundArtifactVersionTest public void testMajorUpperBoundGreaterThanNextMajor() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.2.3" ), - Segment.MAJOR ); + MAJOR ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "2.0.0" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @@ -45,7 +48,7 @@ public void testMajorUpperBoundGreaterThanNextMajor() public void testSubIncrementalUpperBoundGreaterThanNextSubIncremental() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.2.3-2" ), - Segment.SUBINCREMENTAL ); + SUBINCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.2.3-3" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @@ -54,7 +57,7 @@ public void testSubIncrementalUpperBoundGreaterThanNextSubIncremental() public void testVersionShorterThanSegment() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), - Segment.INCREMENTAL ); + INCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.3" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @@ -63,7 +66,7 @@ public void testVersionShorterThanSegment() public void testVersionBoundArtifactVersionShorterThanConcreteVersionAndSegment() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), - Segment.SUBINCREMENTAL ); + SUBINCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.3" ); assertThat( bound.compareTo( artifactVersion ), lessThan( 0 ) ); } @@ -72,7 +75,7 @@ public void testVersionBoundArtifactVersionShorterThanConcreteVersionAndSegment( public void testVersionSubIncrementalBoundGreaterThanSubIncremental() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), - Segment.SUBINCREMENTAL ); + SUBINCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.0-2" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @@ -81,7 +84,7 @@ public void testVersionSubIncrementalBoundGreaterThanSubIncremental() public void testVersionSubIncrementalBoundGreaterThanIncremental() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), - Segment.INCREMENTAL ); + INCREMENTAL ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.1.3" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @@ -90,7 +93,7 @@ public void testVersionSubIncrementalBoundGreaterThanIncremental() public void testVersionSubIncrementalBoundGreaterThanMinor() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.1" ), - Segment.MINOR ); + MINOR ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.3" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } @@ -99,7 +102,7 @@ public void testVersionSubIncrementalBoundGreaterThanMinor() public void testSnapshotWithSubIncremental() { BoundArtifactVersion bound = new BoundArtifactVersion( new DefaultArtifactVersion( "1.0.0-SNAPSHOT" ), - Segment.MINOR ); + MINOR ); ArtifactVersion artifactVersion = new DefaultArtifactVersion( "1.0.0" ); assertThat( bound.compareTo( artifactVersion ), greaterThan( 0 ) ); } diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java b/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java rename to versions-common/src/test/java/org/codehaus/mojo/versions/ordering/MavenVersionComparatorTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java b/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java rename to versions-common/src/test/java/org/codehaus/mojo/versions/ordering/MercuryVersionComparatorTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java b/versions-common/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-common/src/test/java/org/codehaus/mojo/versions/ordering/NumericVersionComparatorTest.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java b/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java similarity index 100% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java rename to versions-common/src/test/java/org/codehaus/mojo/versions/ordering/VersionComparatorTestBase.java diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/recording/ChangeRecorderXMLTest.java b/versions-common/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-common/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-common/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-common/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-common/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-common/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-common/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java similarity index 63% rename from versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java rename to versions-common/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java index cc0e880cc5..2041c82e9c 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.java +++ b/versions-common/src/test/java/org/codehaus/mojo/versions/utils/PropertiesVersionsFileReaderTest.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.util.Arrays; import java.util.HashSet; diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/utils/SegmentUtilsTest.java b/versions-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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-common/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..3881b4f003 100644 --- a/versions-maven-plugin/pom.xml +++ b/versions-maven-plugin/pom.xml @@ -27,6 +27,12 @@ ${project.version} + + org.codehaus.mojo.versions + versions-common + ${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/filtering/NullAwareWildcardMatcher.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java deleted file mode 100644 index dfa8fef64c..0000000000 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/filtering/NullAwareWildcardMatcher.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.codehaus.mojo.versions.filtering; - -public class NullAwareWildcardMatcher extends WildcardMatcher -{ - public static final String NULL_KEYWORD = "null"; - - public NullAwareWildcardMatcher( String pattern ) - { - super( pattern ); - } - - @Override - public boolean test( String token ) - { - if ( NULL_KEYWORD.equals( getPattern() ) ) - { - return token == null; - } - - return super.test( token ); - } -} 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;