From c395a88755d3f68def8ba35da6928b11b4aff3bd Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 16 Feb 2023 11:10:29 -0800 Subject: [PATCH] Refresh component for January 2023 --- enforcer-rules/pom.xml | 10 +- .../enforcer/RequireExtensionVersion.java | 149 ++++++++++++++++-- git-changelist-maven-extension/pom.xml | 2 +- lib/pom.xml | 14 +- .../tools/incrementals/lib/UpdateChecker.java | 2 +- maven-plugin/pom.xml | 52 ++++-- .../maven/IncrementalifyMojo.java | 95 +++++++++-- .../tools/incrementals/maven/UpdateMojo.java | 18 ++- .../incrementals/maven/util/PluginRef.java | 18 +-- .../maven/util/PluginRefList.java | 6 +- pom.xml | 7 +- 11 files changed, 319 insertions(+), 54 deletions(-) diff --git a/enforcer-rules/pom.xml b/enforcer-rules/pom.xml index 6323a88..02d9f2b 100644 --- a/enforcer-rules/pom.xml +++ b/enforcer-rules/pom.xml @@ -8,10 +8,16 @@ incrementals-enforcer-rules + + org.apache.maven + maven-core + provided + org.apache.maven.enforcer - enforcer-rules - 3.0.0-M1 + enforcer-api + 3.2.1 + provided \ No newline at end of file diff --git a/enforcer-rules/src/main/java/io/jenkins/tools/incrementals/enforcer/RequireExtensionVersion.java b/enforcer-rules/src/main/java/io/jenkins/tools/incrementals/enforcer/RequireExtensionVersion.java index 85570d2..0d0ba8d 100644 --- a/enforcer-rules/src/main/java/io/jenkins/tools/incrementals/enforcer/RequireExtensionVersion.java +++ b/enforcer-rules/src/main/java/io/jenkins/tools/incrementals/enforcer/RequireExtensionVersion.java @@ -25,32 +25,60 @@ package io.jenkins.tools.incrementals.enforcer; import java.util.List; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.inject.Inject; +import javax.inject.Named; import org.apache.maven.AbstractMavenLifecycleParticipant; +import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.enforcer.rule.api.AbstractEnforcerRule; import org.apache.maven.enforcer.rule.api.EnforcerRuleException; -import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.enforcer.AbstractVersionEnforcer; +import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.util.StringUtils; /** * Verifies that {@code git-changelist-maven-extension}, if present, is sufficiently new. */ -public class RequireExtensionVersion extends AbstractVersionEnforcer { +@Named("requireExtensionVersion") +public class RequireExtensionVersion extends AbstractEnforcerRule { private static final Pattern ID_PATTERN = Pattern.compile("\\QcoreExtension>io.jenkins.tools.incrementals:git-changelist-maven-extension:\\E(.+)"); + /** + * Specify the required version. Some examples are: + * + * + * @see {@link #setVersion(String)} + * @see {@link #getVersion()} + */ + private String version; + + private final PlexusContainer container; + + @Inject + public RequireExtensionVersion(PlexusContainer container) { + this.container = Objects.requireNonNull(container); + } + @Override - public void execute(EnforcerRuleHelper erh) throws EnforcerRuleException { - Log log = erh.getLog(); + public void execute() throws EnforcerRuleException { List participants; try { - participants = erh.getContainer().lookupList(AbstractMavenLifecycleParticipant.class); + participants = container.lookupList(AbstractMavenLifecycleParticipant.class); } catch (ComponentLookupException x) { - log.warn(x); + getLog().warn(x.getMessage()); return; } for (AbstractMavenLifecycleParticipant participant : participants) { @@ -59,10 +87,113 @@ public void execute(EnforcerRuleHelper erh) throws EnforcerRuleException { if (loader instanceof ClassRealm) { Matcher m = ID_PATTERN.matcher(((ClassRealm) loader).getId()); if (m.matches()) { - enforceVersion(log, "git-changelist-maven-extension", getVersion(), new DefaultArtifactVersion(m.group(1))); + enforceVersion("git-changelist-maven-extension", getVersion(), new DefaultArtifactVersion(m.group(1))); } } } } + /** + * Compares the specified version to see if it is allowed by the defined version range. + * + * @param variableName name of variable to use in messages (Example: "Maven" or "Java" etc). + * @param requiredVersionRange range of allowed versions. + * @param actualVersion the version to be checked. + * @throws EnforcerRuleException the enforcer rule exception + */ + // CHECKSTYLE_OFF: LineLength + private void enforceVersion(String variableName, String requiredVersionRange, ArtifactVersion actualVersion) + throws EnforcerRuleException + // CHECKSTYLE_ON: LineLength + { + if (StringUtils.isEmpty(requiredVersionRange)) { + throw new EnforcerRuleException(variableName + " version can't be empty."); + } else { + + VersionRange vr; + String msg = "Detected " + variableName + " Version: " + actualVersion; + + // short circuit check if the strings are exactly equal + if (actualVersion.toString().equals(requiredVersionRange)) { + getLog().debug(msg + " is allowed in the range " + requiredVersionRange + "."); + } else { + try { + vr = VersionRange.createFromVersionSpec(requiredVersionRange); + + if (containsVersion(vr, actualVersion)) { + getLog().debug(msg + " is allowed in the range " + toString(vr) + "."); + } else { + throw new EnforcerRuleException(msg + " is not in the allowed range " + toString(vr) + "."); + } + } catch (InvalidVersionSpecificationException e) { + throw new EnforcerRuleException( + "The requested " + variableName + " version " + requiredVersionRange + " is invalid.", e); + } + } + } + } + + /** + * Copied from Artifact.VersionRange. This is tweaked to handle singular ranges properly. Currently the default + * containsVersion method assumes a singular version means allow everything. This method assumes that "2.0.4" == + * "[2.0.4,)" + * + * @param allowedRange range of allowed versions. + * @param theVersion the version to be checked. + * @return true if the version is contained by the range. + */ + private static boolean containsVersion(VersionRange allowedRange, ArtifactVersion theVersion) { + ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion(); + if (recommendedVersion == null) { + return allowedRange.containsVersion(theVersion); + } else { + // only singular versions ever have a recommendedVersion + int compareTo = recommendedVersion.compareTo(theVersion); + return (compareTo <= 0); + } + } + + private static String toString(VersionRange vr) { + // as recommended version is used as lower bound in this context modify the string representation + if (vr.getRecommendedVersion() != null) { + return "[" + vr.getRecommendedVersion().toString() + ",)"; + } else { + return vr.toString(); + } + } + + @Override + public String getCacheId() { + if (StringUtils.isNotEmpty(version)) { + // return the hashcodes of the parameter that matters + return "" + version.hashCode(); + } else { + return "0"; + } + } + + /** + * Gets the required version. + * + * @return the required version + */ + public final String getVersion() { + return this.version; + } + + /** + * Specify the required version. Some examples are: + * + * + * @param theVersion the required version to set + */ + public void setVersion(String theVersion) { + this.version = theVersion; + } } diff --git a/git-changelist-maven-extension/pom.xml b/git-changelist-maven-extension/pom.xml index 0adecfe..5f4a2c6 100644 --- a/git-changelist-maven-extension/pom.xml +++ b/git-changelist-maven-extension/pom.xml @@ -14,7 +14,7 @@ org.codehaus.plexus plexus-component-metadata - 1.7.1 + 2.1.1 diff --git a/lib/pom.xml b/lib/pom.xml index a4541cf..cd0c5d0 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -9,10 +9,16 @@ lib - com.google.code.findbugs - jsr305 - 3.0.2 - provided + com.github.spotbugs + spotbugs-annotations + 4.7.3 + true + + + com.google.code.findbugs + jsr305 + + org.apache.maven diff --git a/lib/src/main/java/io/jenkins/tools/incrementals/lib/UpdateChecker.java b/lib/src/main/java/io/jenkins/tools/incrementals/lib/UpdateChecker.java index a924c66..94dd49b 100644 --- a/lib/src/main/java/io/jenkins/tools/incrementals/lib/UpdateChecker.java +++ b/lib/src/main/java/io/jenkins/tools/incrementals/lib/UpdateChecker.java @@ -34,7 +34,7 @@ import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.annotation.CheckForNull; +import edu.umd.cs.findbugs.annotations.CheckForNull; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.maven.artifact.versioning.ComparableVersion; import org.kohsuke.github.GHCompare; diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml index 765f1f7..e69f365 100644 --- a/maven-plugin/pom.xml +++ b/maven-plugin/pom.xml @@ -8,6 +8,9 @@ incrementals-maven-plugin maven-plugin + + 3.7.1 + ${project.groupId} @@ -17,30 +20,61 @@ org.codehaus.mojo versions-maven-plugin - 2.5 + 2.14.2 org.apache.maven.plugin-tools maven-plugin-annotations - 3.5.1 + ${maven-plugin-tools.version} provided org.twdata.maven mojo-executor - 2.3.0 + 2.4.0 + + + org.apache.maven + maven-artifact + provided + + + org.apache.maven + maven-compat + provided + + + org.apache.maven + maven-core + provided + + + org.apache.maven + maven-model + provided + + + org.apache.maven + maven-plugin-api + provided junit junit - 4.13.1 + 4.13.2 test - com.google.code.findbugs - jsr305 - 3.0.2 - provided + com.github.spotbugs + spotbugs-annotations + 4.7.3 + true + + + com.google.code.findbugs + jsr305 + + @@ -49,7 +83,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5.1 + ${maven-plugin-tools.version} diff --git a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/IncrementalifyMojo.java b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/IncrementalifyMojo.java index 924820e..040507e 100644 --- a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/IncrementalifyMojo.java +++ b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/IncrementalifyMojo.java @@ -28,10 +28,12 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; +import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.inject.Inject; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.XMLEvent; @@ -39,7 +41,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ComparableVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; @@ -49,9 +50,14 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.AbstractVersionsUpdaterMojo; import org.codehaus.mojo.versions.api.ArtifactVersions; import org.codehaus.mojo.versions.api.PomHelper; +import org.codehaus.mojo.versions.api.VersionRetrievalException; +import org.codehaus.mojo.versions.api.VersionsHelper; +import org.codehaus.mojo.versions.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; import static org.twdata.maven.mojoexecutor.MojoExecutor.*; @@ -70,18 +76,26 @@ public class IncrementalifyMojo extends AbstractVersionsUpdaterMojo { @Component private BuildPluginManager pluginManager; + @Inject public IncrementalifyMojo(RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, Map wagonMap, Map changeRecorders) { + super(repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders); + } + @Override public void execute() throws MojoExecutionException, MojoFailureException { File dotMvn = new File(project.getBasedir(), ".mvn"); File extensionsXml = new File(dotMvn, "extensions.xml"); if (extensionsXml.isFile()) { throw new MojoFailureException("Editing an existing " + extensionsXml + " is not yet supported"); } - VersionRange any; ArtifactVersions gclmeVersions; + try { + gclmeVersions = getHelper().lookupArtifactVersions(getHelper().createDependencyArtifact("io.jenkins.tools.incrementals", "git-changelist-maven-extension", "[0,)", "type", null, null), true); + } catch (VersionRetrievalException x) { + throw new MojoExecutionException(x.getMessage(), x); + } + VersionRange any; try { any = VersionRange.createFromVersionSpec("[0,)"); - gclmeVersions = getHelper().lookupArtifactVersions(getHelper().createDependencyArtifact("io.jenkins.tools.incrementals", "git-changelist-maven-extension", any, "type", null, null), true); - } catch (ArtifactMetadataRetrievalException | InvalidVersionSpecificationException x) { + } catch (InvalidVersionSpecificationException x) { throw new MojoExecutionException(x.getMessage(), x); } ArtifactVersion gclmeNewestVersion = gclmeVersions.getNewestVersion(any, false); @@ -105,7 +119,7 @@ public class IncrementalifyMojo extends AbstractVersionsUpdaterMojo { } } - @Override protected void update(ModifiedPomXMLEventReader pom) throws MojoExecutionException, MojoFailureException, XMLStreamException, ArtifactMetadataRetrievalException { + @Override protected void update(ModifiedPomXMLEventReader pom) throws MojoExecutionException, MojoFailureException, XMLStreamException { String version = PomHelper.getProjectVersion(pom); Matcher m = Pattern.compile("(.+)-SNAPSHOT").matcher(version); if (!m.matches()) { @@ -115,7 +129,7 @@ public class IncrementalifyMojo extends AbstractVersionsUpdaterMojo { if (!origTag.equals("HEAD")) { throw new MojoFailureException("Unexpected tag: " + origTag); } - Artifact parent = PomHelper.getProjectParent(pom, getHelper()); + Artifact parent = getProjectParent(pom, getHelper()); if (parent == null) { throw new MojoFailureException("No found"); } @@ -146,10 +160,71 @@ public class IncrementalifyMojo extends AbstractVersionsUpdaterMojo { prependProperty(pom, "gitHubRepo", connectionRGHR.gitHubRepo); prependProperty(pom, "changelist", "-SNAPSHOT"); prependProperty(pom, "revision", m.group(1)); - PomHelper.setProjectValue(pom, "/project/scm/tag", "${scmTag}"); - PomHelper.setProjectValue(pom, "/project/scm/connection", connectionRGHR.interpolableText); - PomHelper.setProjectValue(pom, "/project/scm/developerConnection", developerConnectionRGHR.interpolableText); - PomHelper.setProjectValue(pom, "/project/scm/url", urlRGHR.interpolableText); + PomHelper.setElementValue(pom, "/project/scm", "tag", "${scmTag}"); + PomHelper.setElementValue(pom, "/project/scm", "connection", connectionRGHR.interpolableText); + PomHelper.setElementValue(pom, "/project/scm", "developerConnection", developerConnectionRGHR.interpolableText); + PomHelper.setElementValue(pom, "/project/scm", "url", urlRGHR.interpolableText); + } + + /** + * Gets the parent artifact from the pom. + * + * @param pom The pom. + * @param helper The helper (used to create the artifact). + * @return The parent artifact or null if no parent is specified. + * @throws XMLStreamException if something went wrong. + */ + private static Artifact getProjectParent( final ModifiedPomXMLEventReader pom, VersionsHelper helper ) + throws XMLStreamException + { + Stack stack = new Stack<>(); + String path = ""; + final Pattern matchScopeRegex = Pattern.compile( "/project/parent((/groupId)|(/artifactId)|(/version))" ); + String groupId = null; + String artifactId = null; + String version = null; + + pom.rewind(); + + while ( pom.hasNext() ) + { + XMLEvent event = pom.nextEvent(); + if ( event.isStartElement() ) + { + stack.push( path ); + final String elementName = event.asStartElement().getName().getLocalPart(); + path = path + "/" + elementName; + + if ( matchScopeRegex.matcher( path ).matches() ) + { + if ( "groupId".equals( elementName ) ) + { + groupId = pom.getElementText().trim(); + path = stack.pop(); + } + else if ( "artifactId".equals( elementName ) ) + { + artifactId = pom.getElementText().trim(); + path = stack.pop(); + } + else if ( "version".equals( elementName ) ) + { + version = pom.getElementText().trim(); + path = stack.pop(); + } + } + } + if ( event.isEndElement() ) + { + path = stack.pop(); + } + } + if ( groupId == null || artifactId == null || version == null ) + { + return null; + } + return helper.createDependencyArtifact( groupId, artifactId, version, "pom", + null, null ); } private static final class ReplaceGitHubRepo { diff --git a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/UpdateMojo.java b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/UpdateMojo.java index 005197b..f24f113 100644 --- a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/UpdateMojo.java +++ b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/UpdateMojo.java @@ -28,10 +28,10 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import javax.inject.Inject; import javax.xml.stream.XMLStreamException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.repository.MavenArtifactRepository; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; @@ -39,13 +39,17 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.wagon.Wagon; import org.codehaus.mojo.versions.AbstractVersionsDependencyUpdaterMojo; -import org.codehaus.mojo.versions.Property; import org.codehaus.mojo.versions.UpdatePropertiesMojo; import org.codehaus.mojo.versions.UseLatestReleasesMojo; 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.api.recording.ChangeRecorder; import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader; /** @@ -74,7 +78,11 @@ public class UpdateMojo extends AbstractVersionsDependencyUpdaterMojo { @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true) private List repos; - @Override protected void update(ModifiedPomXMLEventReader pom) throws MojoExecutionException, MojoFailureException, XMLStreamException, ArtifactMetadataRetrievalException { + @Inject public UpdateMojo(RepositorySystem repositorySystem, org.eclipse.aether.RepositorySystem aetherRepositorySystem, Map wagonMap, Map changeRecorders) { + super(repositorySystem, aetherRepositorySystem, wagonMap, changeRecorders); + } + + @Override protected void update(ModifiedPomXMLEventReader pom) throws MojoExecutionException, MojoFailureException, XMLStreamException { try { UpdateChecker checker = new UpdateChecker(message -> getLog().info(message), // TODO use repos.stream().map(MavenArtifactRepository::getUrl).collect(Collectors.toList()) if UpdateChecker.loadVersions is fixed to exclude snapshots and pass authentication @@ -92,7 +100,7 @@ public class UpdateMojo extends AbstractVersionsDependencyUpdaterMojo { } } updateProperties(pom, checker); - } catch (MojoExecutionException | MojoFailureException | XMLStreamException | ArtifactMetadataRetrievalException x) { + } catch (MojoExecutionException | MojoFailureException | XMLStreamException x) { throw x; } catch (Exception x) { throw new MojoExecutionException("Update failed", x); @@ -133,7 +141,7 @@ private void update(ModifiedPomXMLEventReader pom, List dependencies } private void updateProperties(ModifiedPomXMLEventReader pom, UpdateChecker checker) throws Exception { - PROPERTY: for (Map.Entry entry : getHelper().getVersionPropertiesMap(getProject(), /* TODO */ new Property[0], /* TODO */ null, null, true).entrySet()) { + PROPERTY: for (Map.Entry entry : getHelper().getVersionPropertiesMap(VersionsHelper.VersionPropertiesMapRequest.builder().withMavenProject(getProject()).build()).entrySet()) { Property property = entry.getKey(); String name = property.getName(); PropertyVersions versions = entry.getValue(); diff --git a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRef.java b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRef.java index 0ba8d0d..706cae3 100644 --- a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRef.java +++ b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRef.java @@ -25,8 +25,8 @@ import org.apache.maven.model.Dependency; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; import java.io.IOException; /** @@ -100,7 +100,7 @@ public String toString() { return artifactId + (version != null ? (":" + version) : ""); } - @Nonnull + @NonNull public String toPluginsTxtString() { if (comment != null) { return comment; @@ -121,19 +121,19 @@ public String toPluginsTxtString() { return artifactId + (label != null ? (":" + label) : ""); } - @Nonnull - public static PluginRef forComment(@Nonnull String line) throws IOException { + @NonNull + public static PluginRef forComment(@NonNull String line) throws IOException { PluginRef ref = new PluginRef(); ref.comment = line; return ref; } - public void setVersion(@Nonnull String version) { + public void setVersion(@NonNull String version) { this.version = version; } - @Nonnull - public static PluginRef fromString(@Nonnull String str) throws IOException { + @NonNull + public static PluginRef fromString(@NonNull String str) throws IOException { String[] entries = str.split(":"); if (entries.length == 0) { throw new IOException("Version string is corrupted: " + str); @@ -174,7 +174,7 @@ public static PluginRef fromString(@Nonnull String str) throws IOException { return plugin; } - @Nonnull + @NonNull public Dependency toDependency() { Dependency dep = new Dependency(); dep.setArtifactId(artifactId); diff --git a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRefList.java b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRefList.java index ee676dc..dd53b50 100644 --- a/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRefList.java +++ b/maven-plugin/src/main/java/io/jenkins/tools/incrementals/maven/util/PluginRefList.java @@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.model.Dependency; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -57,7 +57,7 @@ public static PluginRefList fromFile(File file) throws IOException { return plugins; } - @Nonnull + @NonNull public List toDependencyList() { List depList = new ArrayList<>(this.size()); for (PluginRef plugin : this) { @@ -67,7 +67,7 @@ public List toDependencyList() { } - public void writeToFile(@Nonnull File dest) throws IOException { + public void writeToFile(@NonNull File dest) throws IOException { List outputLines = new ArrayList<>(this.size()); for (PluginRef ref : this) { outputLines.add(ref.toPluginsTxtString()); diff --git a/pom.xml b/pom.xml index 90d91ac..b1712eb 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ UTF-8 - 3.5.0 + 3.9.0 lib @@ -64,6 +64,11 @@ maven-artifact ${maven.version} + + org.apache.maven + maven-compat + ${maven.version} + org.apache.maven maven-core