Skip to content

Commit 50c1e86

Browse files
committed
Resolves #809: Extract the apis and common services to a separate module
1 parent 6a950e2 commit 50c1e86

File tree

103 files changed

+506
-449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+506
-449
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
<module>versions-maven-plugin</module>
100100
<module>model-ruleset</module>
101101
<module>model-report</module>
102+
<module>versions-api</module>
102103
</modules>
103104

104105
<scm>

versions-api/pom.xml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>versions</artifactId>
7+
<groupId>org.codehaus.mojo.versions</groupId>
8+
<version>2.14.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>versions-api</artifactId>
13+
14+
<name>Versions API</name>
15+
<description>API for Versions Maven Plugin</description>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.codehaus.mojo.versions</groupId>
20+
<artifactId>model-ruleset</artifactId>
21+
<version>${project.version}</version>
22+
</dependency>
23+
24+
<dependency>
25+
<groupId>org.apache.maven</groupId>
26+
<artifactId>maven-artifact</artifactId>
27+
<version>${mavenVersion}</version>
28+
<scope>provided</scope>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.apache.maven</groupId>
33+
<artifactId>maven-core</artifactId>
34+
<version>${mavenVersion}</version>
35+
<scope>provided</scope>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.apache.maven</groupId>
39+
<artifactId>maven-compat</artifactId>
40+
<version>${mavenVersion}</version>
41+
<scope>provided</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.maven</groupId>
45+
<artifactId>maven-model</artifactId>
46+
<version>${mavenVersion}</version>
47+
<scope>provided</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.apache.maven</groupId>
51+
<artifactId>maven-plugin-api</artifactId>
52+
<version>${mavenVersion}</version>
53+
<scope>provided</scope>
54+
</dependency>
55+
<dependency>
56+
<groupId>org.apache.maven</groupId>
57+
<artifactId>maven-settings</artifactId>
58+
<version>${mavenVersion}</version>
59+
<scope>provided</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.apache.maven.wagon</groupId>
63+
<artifactId>wagon-provider-api</artifactId>
64+
<version>${wagonVersion}</version>
65+
<scope>provided</scope>
66+
</dependency>
67+
<!-- woodstox only used for unit tests -->
68+
<dependency>
69+
<groupId>com.fasterxml.woodstox</groupId>
70+
<artifactId>woodstox-core</artifactId>
71+
<scope>test</scope>
72+
</dependency>
73+
<!-- wagon only used for unit tests -->
74+
<dependency>
75+
<groupId>org.apache.maven.wagon</groupId>
76+
<artifactId>wagon-file</artifactId>
77+
<version>${wagonVersion}</version>
78+
<scope>test</scope>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.apache.commons</groupId>
82+
<artifactId>commons-lang3</artifactId>
83+
</dependency>
84+
85+
<dependency>
86+
<groupId>org.apache.maven.plugin-testing</groupId>
87+
<artifactId>maven-plugin-testing-harness</artifactId>
88+
<scope>test</scope>
89+
</dependency>
90+
<dependency>
91+
<groupId>org.junit.jupiter</groupId>
92+
<artifactId>junit-jupiter</artifactId>
93+
<scope>test</scope>
94+
</dependency>
95+
<dependency>
96+
<groupId>org.junit.vintage</groupId>
97+
<artifactId>junit-vintage-engine</artifactId>
98+
<scope>test</scope>
99+
<exclusions>
100+
<exclusion>
101+
<groupId>org.hamcrest</groupId>
102+
<artifactId>hamcrest-core</artifactId>
103+
</exclusion>
104+
</exclusions>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.mockito</groupId>
108+
<artifactId>mockito-inline</artifactId>
109+
<scope>test</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.hamcrest</groupId>
113+
<artifactId>hamcrest</artifactId>
114+
<scope>test</scope>
115+
</dependency>
116+
<dependency>
117+
<groupId>org.slf4j</groupId>
118+
<artifactId>slf4j-simple</artifactId>
119+
<scope>test</scope>
120+
</dependency>
121+
</dependencies>
122+
123+
</project>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@
7474
import org.apache.maven.wagon.Wagon;
7575
import org.apache.maven.wagon.authentication.AuthenticationException;
7676
import org.apache.maven.wagon.authorization.AuthorizationException;
77-
import org.codehaus.mojo.versions.PluginUpdatesDetails;
78-
import org.codehaus.mojo.versions.Property;
7977
import org.codehaus.mojo.versions.model.IgnoreVersion;
8078
import org.codehaus.mojo.versions.model.Rule;
8179
import org.codehaus.mojo.versions.model.RuleSet;

versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/PluginUpdatesDetails.java renamed to versions-api/src/main/java/org/codehaus/mojo/versions/api/PluginUpdatesDetails.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.codehaus.mojo.versions;
1+
package org.codehaus.mojo.versions.api;
22

33
/*
44
* Licensed to the Apache Software Foundation (ASF) under one
@@ -24,7 +24,6 @@
2424

2525
import org.apache.maven.artifact.versioning.ArtifactVersion;
2626
import org.apache.maven.model.Dependency;
27-
import org.codehaus.mojo.versions.api.ArtifactVersions;
2827

2928
import static java.util.Optional.empty;
3029

versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/Property.java renamed to versions-api/src/main/java/org/codehaus/mojo/versions/api/Property.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.codehaus.mojo.versions;
1+
package org.codehaus.mojo.versions.api;
22

33
/*
44
* Licensed to the Apache Software Foundation (ASF) under one

versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java renamed to versions-api/src/main/java/org/codehaus/mojo/versions/api/PropertyVersions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.apache.maven.artifact.versioning.Restriction;
4141
import org.apache.maven.artifact.versioning.VersionRange;
4242
import org.apache.maven.project.MavenProject;
43-
import org.codehaus.mojo.versions.Property;
4443
import org.codehaus.mojo.versions.ordering.BoundArtifactVersion;
4544
import org.codehaus.mojo.versions.ordering.InvalidSegmentException;
4645
import org.codehaus.mojo.versions.ordering.VersionComparator;

versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java renamed to versions-api/src/main/java/org/codehaus/mojo/versions/api/VersionsHelper.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
import org.apache.maven.plugin.MojoExecutionException;
3535
import org.apache.maven.plugin.logging.Log;
3636
import org.apache.maven.project.MavenProject;
37-
import org.codehaus.mojo.versions.PluginUpdatesDetails;
38-
import org.codehaus.mojo.versions.Property;
3937
import org.codehaus.mojo.versions.ordering.VersionComparator;
4038
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
4139

@@ -188,7 +186,7 @@ ArtifactVersions lookupDependencyUpdates( Dependency dependency, boolean usePlug
188186
*
189187
* @param plugins The set of {@link Plugin} instances to look up.
190188
* @param allowSnapshots Include snapshots in the list of updates.
191-
* @return A map, keyed by plugin, with values of type {@link org.codehaus.mojo.versions.PluginUpdatesDetails}.
189+
* @return A map, keyed by plugin, with values of type {@link org.codehaus.mojo.versions.api.PluginUpdatesDetails}.
192190
* @throws ArtifactMetadataRetrievalException When things go wrong.
193191
* @since 1.0-beta-1
194192
*/
@@ -218,12 +216,12 @@ PluginUpdatesDetails lookupPluginUpdates( Plugin plugin, boolean allowSnapshots
218216

219217
/**
220218
* Returns a map of {@link org.codehaus.mojo.versions.api.PropertyVersions} values keyed by
221-
* {@link org.codehaus.mojo.versions.Property} instances consisting of the properties defined in the project which
219+
* {@link Property} instances consisting of the properties defined in the project which
222220
* are associated with version information.
223221
*
224222
* @param request {@link VersionPropertiesMapRequest} instance containing the arguments
225223
* @return a map of {@link org.codehaus.mojo.versions.api.PropertyVersions} values keyed by
226-
* {@link org.codehaus.mojo.versions.Property} instances.
224+
* {@link Property} instances.
227225
* @throws MojoExecutionException if something goes wrong.
228226
*/
229227
Map<Property, PropertyVersions> getVersionPropertiesMap( VersionPropertiesMapRequest request )
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
package org.codehaus.mojo.versions.filtering;
22

3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
322
import java.util.List;
423
import java.util.Set;
524
import java.util.TreeSet;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package org.codehaus.mojo.versions.filtering;
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
public class NullAwareWildcardMatcher extends WildcardMatcher
23+
{
24+
public static final String NULL_KEYWORD = "null";
25+
26+
public NullAwareWildcardMatcher( String pattern )
27+
{
28+
super( pattern );
29+
}
30+
31+
@Override
32+
public boolean test( String token )
33+
{
34+
if ( NULL_KEYWORD.equals( getPattern() ) )
35+
{
36+
return token == null;
37+
}
38+
39+
return super.test( token );
40+
}
41+
}
Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
package org.codehaus.mojo.versions.utils;
22

3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
322
import java.io.IOException;
423
import java.io.InputStream;
524
import java.nio.file.Files;
@@ -9,8 +28,11 @@
928
import java.util.Properties;
1029
import java.util.stream.Collectors;
1130

12-
import org.codehaus.mojo.versions.Property;
31+
import org.codehaus.mojo.versions.api.Property;
1332

33+
/**
34+
* Reader class for reading property files
35+
*/
1436
public class PropertiesVersionsFileReader
1537
{
1638

@@ -23,11 +45,19 @@ public class PropertiesVersionsFileReader
2345

2446
private String propertyFilePath;
2547

48+
/**
49+
* Creates an instance of the object with the given path to the property file
50+
* @param filePath path to the property file
51+
*/
2652
public PropertiesVersionsFileReader( String filePath )
2753
{
2854
propertyFilePath = filePath;
2955
}
3056

57+
/**
58+
* Reads the property file
59+
* @throws IOException thrown if an I/O exception occurs during the read operation
60+
*/
3161
public void read() throws IOException
3262
{
3363
try ( InputStream input = Files.newInputStream( Paths.get( propertyFilePath ) ) )
@@ -55,11 +85,19 @@ public void read() throws IOException
5585
}
5686
}
5787

88+
/**
89+
* Returns the string contents of the property file
90+
* @return contents of the property file
91+
*/
5892
public String getProperties()
5993
{
6094
return propertiesCsv;
6195
}
6296

97+
/**
98+
* Returns the array of {@link Property} objects
99+
* @return array of properties
100+
*/
63101
public Property[] getPropertiesConfig()
64102
{
65103
return propertiesConfig;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.Comparator;
2323

2424
import org.apache.commons.lang3.StringUtils;
25-
import org.codehaus.mojo.versions.Property;
25+
import org.codehaus.mojo.versions.api.Property;
2626

2727
/**
2828
* A comparator used to sort {@link Property} instances.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.apache.maven.project.artifact.MavenMetadataSource;
4545
import org.apache.maven.repository.RepositorySystem;
4646
import org.apache.maven.settings.Settings;
47-
import org.codehaus.mojo.versions.Property;
4847
import org.codehaus.mojo.versions.model.IgnoreVersion;
4948
import org.codehaus.mojo.versions.model.Rule;
5049
import org.codehaus.mojo.versions.model.RuleSet;

0 commit comments

Comments
 (0)