From b31a9295c16e8a629adcef511c9771fbc0e8efc8 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 22 Jul 2022 11:18:22 +0200 Subject: [PATCH] [MPLUGIN-441] Support mojos using the new maven v4 api --- maven-plugin-annotations/pom.xml | 4 +- maven-plugin-plugin/pom.xml | 9 +- .../it/annotation-with-inheritance/pom.xml | 2 +- .../src/it/java-basic-annotations/pom.xml | 2 +- .../src/main/java/fr/ca/MyMojo.java | 3 +- maven-plugin-plugin/src/it/settings.xml | 4 + .../src/it/v4api/invoker.properties | 18 + maven-plugin-plugin/src/it/v4api/pom.xml | 93 ++++ .../org/apache/maven/its/v4api/FirstMojo.java | 91 ++++ .../src/it/v4api/verify.groovy | 166 +++++++ maven-plugin-report-plugin/pom.xml | 4 +- .../src/it/fix-maven-since-3.x/pom.xml | 7 +- .../src/main/java/org/DummyReport.java | 3 +- .../src/it/plugin-report/pom.xml | 2 + .../src/main/java/org/DummyReport.java | 6 +- .../EnhancedPluginDescriptorBuilder.java | 22 +- maven-plugin-tools-annotations/pom.xml | 8 +- ...avaAnnotationsMojoDescriptorExtractor.java | 38 +- .../DefaultMojoAnnotationsScanner.java | 53 +- .../scanner/MojoAnnotatedClass.java | 13 + .../scanner/MojoAnnotationsScanner.java | 15 +- .../scanner/visitors/MojoClassVisitor.java | 56 ++- .../plugin/extractor/annotations/FooMojo.java | 3 +- maven-plugin-tools-api/pom.xml | 4 +- .../tools/plugin/ExtendedMojoDescriptor.java | 11 + .../maven/tools/plugin/util/PluginUtils.java | 9 +- .../tools/plugin/util/stubs/MojoStub.java | 54 +- maven-plugin-tools-generators/pom.xml | 4 +- .../PluginDescriptorFilesGenerator.java | 7 + .../plugin/generator/PluginHelpGenerator.java | 9 +- .../main/resources/help-class-source-v4.vm | 464 ++++++++++++++++++ .../generator/AbstractGeneratorTestCase.java | 18 +- maven-plugin-tools-java/pom.xml | 4 +- .../JavaMojoDescriptorExtractorTest.java | 11 +- maven-script/maven-plugin-tools-ant/pom.xml | 4 +- .../maven-plugin-tools-beanshell/pom.xml | 2 +- maven-script/maven-plugin-tools-model/pom.xml | 4 +- maven-script/maven-script-ant/pom.xml | 2 +- .../maven/script/ant/AntMojoWrapper.java | 3 +- maven-script/maven-script-beanshell/pom.xml | 2 +- maven-script/pom.xml | 2 +- pom.xml | 9 +- 42 files changed, 1092 insertions(+), 153 deletions(-) create mode 100644 maven-plugin-plugin/src/it/v4api/invoker.properties create mode 100644 maven-plugin-plugin/src/it/v4api/pom.xml create mode 100644 maven-plugin-plugin/src/it/v4api/src/main/java/org/apache/maven/its/v4api/FirstMojo.java create mode 100644 maven-plugin-plugin/src/it/v4api/verify.groovy create mode 100644 maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm diff --git a/maven-plugin-annotations/pom.xml b/maven-plugin-annotations/pom.xml index e752eb7d0..1d1bcd033 100644 --- a/maven-plugin-annotations/pom.xml +++ b/maven-plugin-annotations/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - maven-plugin-tools org.apache.maven.plugin-tools - 3.7.1-SNAPSHOT + maven-plugin-tools + 4.0.0-SNAPSHOT maven-plugin-annotations diff --git a/maven-plugin-plugin/pom.xml b/maven-plugin-plugin/pom.xml index 3f69c50f4..b6b222fbe 100644 --- a/maven-plugin-plugin/pom.xml +++ b/maven-plugin-plugin/pom.xml @@ -21,9 +21,9 @@ 4.0.0 - maven-plugin-tools org.apache.maven.plugin-tools - 3.7.1-SNAPSHOT + maven-plugin-tools + 4.0.0-SNAPSHOT org.apache.maven.plugins @@ -38,11 +38,12 @@ - ${mavenVersion} + 3.2.5 true + 8 @@ -135,7 +136,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml b/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml index b00ab7d58..ec477fa19 100644 --- a/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml +++ b/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml @@ -58,7 +58,7 @@ under the License. compile - org.codehaus.plexus + org.apache.maven plexus-utils @plexusUtilsVersion@ diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml b/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml index 19ee2b15f..81f204fda 100644 --- a/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml +++ b/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml @@ -52,7 +52,7 @@ under the License. provided - org.codehaus.plexus + org.apache.maven plexus-utils @plexusUtilsVersion@ diff --git a/maven-plugin-plugin/src/it/mplugin-272_java8/src/main/java/fr/ca/MyMojo.java b/maven-plugin-plugin/src/it/mplugin-272_java8/src/main/java/fr/ca/MyMojo.java index 077502034..7ba20750f 100644 --- a/maven-plugin-plugin/src/it/mplugin-272_java8/src/main/java/fr/ca/MyMojo.java +++ b/maven-plugin-plugin/src/it/mplugin-272_java8/src/main/java/fr/ca/MyMojo.java @@ -21,7 +21,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -31,7 +30,7 @@ @Mojo(name="test-plugin",defaultPhase = LifecyclePhase.GENERATE_SOURCES) public class MyMojo extends AbstractMojo { @Override - public void execute() throws MojoExecutionException, MojoFailureException { + public void execute() throws MojoExecutionException { } } diff --git a/maven-plugin-plugin/src/it/settings.xml b/maven-plugin-plugin/src/it/settings.xml index 44480e37e..564f5d6ec 100644 --- a/maven-plugin-plugin/src/it/settings.xml +++ b/maven-plugin-plugin/src/it/settings.xml @@ -39,9 +39,11 @@ under the License. @localRepositoryUrl@ true + ignore true + ignore @@ -51,9 +53,11 @@ under the License. @localRepositoryUrl@ true + ignore true + ignore diff --git a/maven-plugin-plugin/src/it/v4api/invoker.properties b/maven-plugin-plugin/src/it/v4api/invoker.properties new file mode 100644 index 000000000..43be5b1d2 --- /dev/null +++ b/maven-plugin-plugin/src/it/v4api/invoker.properties @@ -0,0 +1,18 @@ +# 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. + +invoker.goals.1 = clean install diff --git a/maven-plugin-plugin/src/it/v4api/pom.xml b/maven-plugin-plugin/src/it/v4api/pom.xml new file mode 100644 index 000000000..0c541f0d2 --- /dev/null +++ b/maven-plugin-plugin/src/it/v4api/pom.xml @@ -0,0 +1,93 @@ + + + + + + 4.0.0 + + org.apache.maven.its + v4api + 1.0-SNAPSHOT + maven-plugin + + Maven Integration Test :: v4api + + Test plugin-plugin, which tests maven-plugin-tools-api and + maven-plugin-tools-java. This will generate a plugin descriptor from + java-based mojo sources, install the plugin, and then use it. + + + + UTF-8 + + + 1.8 + 1.8 + + + + + org.apache.maven + maven-api-core + @maven4Version@ + provided + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + true + + + + mojo-descriptor + + descriptor + + + + help-goal + + helpmojo + + + + + + + diff --git a/maven-plugin-plugin/src/it/v4api/src/main/java/org/apache/maven/its/v4api/FirstMojo.java b/maven-plugin-plugin/src/it/v4api/src/main/java/org/apache/maven/its/v4api/FirstMojo.java new file mode 100644 index 000000000..c8a9c2b0a --- /dev/null +++ b/maven-plugin-plugin/src/it/v4api/src/main/java/org/apache/maven/its/v4api/FirstMojo.java @@ -0,0 +1,91 @@ +package org.apache.maven.its.v4api; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.api.MojoExecution; +import org.apache.maven.api.ResolutionScope; +import org.apache.maven.api.Session; +import org.apache.maven.api.plugin.Log; +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.Component; +import org.apache.maven.api.plugin.annotations.Execute; +import org.apache.maven.api.plugin.annotations.LifecyclePhase; +import org.apache.maven.api.plugin.annotations.Mojo; +import org.apache.maven.api.plugin.annotations.Parameter; +import org.apache.maven.api.Project; +import org.apache.maven.api.services.ArtifactInstaller; +import org.apache.maven.api.settings.Settings; + +import java.nio.file.Path; + +/** + * Touches a test file. + * + * @since 1.2 + */ +@Mojo( name = "first", requiresDependencyResolution = ResolutionScope.TEST, + defaultPhase = LifecyclePhase.INTEGRATION_TEST ) +@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" ) +public class FirstMojo + implements org.apache.maven.api.plugin.Mojo +{ + + /** + * Project directory. + */ + @Parameter( defaultValue = "${basedir}", readonly = true ) + private Path basedir; + + @Parameter( property = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt", + required = true ) + private Path touchFile; + + /** + * @since 0.1 + * @deprecated As of 0.2 + */ + @Deprecated + @Parameter( name = "namedParam", alias = "alias" ) + private String aliasedParam; + + @Component + private Session session; + + @Component + private Project project; + + @Component + private MojoExecution mojo; + + @Component + private Settings settings; + + @Component + private Log log; + + @Component( role = ArtifactInstaller.class, hint = "test" ) + private Object custom; + + public void execute() + throws MojoException + { + } + +} diff --git a/maven-plugin-plugin/src/it/v4api/verify.groovy b/maven-plugin-plugin/src/it/v4api/verify.groovy new file mode 100644 index 000000000..89f5f2938 --- /dev/null +++ b/maven-plugin-plugin/src/it/v4api/verify.groovy @@ -0,0 +1,166 @@ +/* + * 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. + */ + +File descriptorFile = new File( basedir, "target/classes/META-INF/maven/plugin.xml" ); +assert descriptorFile.isFile() + +def pluginDescriptor = new XmlParser().parse( descriptorFile ); + +assert pluginDescriptor.requiredJavaVersion.text() == '1.8' +assert pluginDescriptor.requiredMavenVersion.text() == '4.0.0-alpha-2' + +def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0] + +assert mojo.goal.text() == 'first' +assert mojo.implementation.text() == 'org.apache.maven.its.v4api.FirstMojo' +assert mojo.language.text() == 'java' +assert mojo.description.text() == 'Touches a test file.' +assert mojo.requiresDependencyResolution.text() == 'test' +assert mojo.requiresDependencyCollection.text() == '' +assert mojo.requiresProject.text() == 'true' +assert mojo.requiresOnline.text() == 'false' +assert mojo.requiresDirectInvocation.text() == 'false' +assert mojo.aggregator.text() == 'false' +assert mojo.threadSafe.text() == 'false' +assert mojo.phase.text() == 'integration-test' +assert mojo.executePhase.text() == 'generate-sources' +assert mojo.executeLifecycle.text() == 'cobertura' +assert mojo.v4Api.text() == 'true' + +assert mojo.configuration.basedir[0].text() == '' +assert mojo.configuration.basedir[0].'@implementation' == 'java.nio.file.Path' +assert mojo.configuration.basedir[0].'@default-value' == '${basedir}' + +assert mojo.configuration.touchFile[0].text() == '${first.touchFile}' +assert mojo.configuration.touchFile[0].'@implementation' == 'java.nio.file.Path' +assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt' + +assert mojo.configuration.session[0].text() == '' +assert mojo.configuration.session[0].'@implementation' == 'org.apache.maven.api.Session' +assert mojo.configuration.session[0].'@default-value' == '${session}' + +assert mojo.configuration.project[0].text() == '' +assert mojo.configuration.project[0].'@implementation' == 'org.apache.maven.api.Project' +assert mojo.configuration.project[0].'@default-value' == '${project}' + +assert mojo.configuration.mojo[0].text() == '' +assert mojo.configuration.mojo[0].'@implementation' == 'org.apache.maven.api.MojoExecution' +assert mojo.configuration.mojo[0].'@default-value' == '${mojoExecution}' + +assert mojo.configuration.settings[0].text() == '' +assert mojo.configuration.settings[0].'@implementation' == 'org.apache.maven.api.settings.Settings' +assert mojo.configuration.settings[0].'@default-value' == '${settings}' + +assert mojo.requirements.requirement.size() == 2 + +assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.api.services.ArtifactInstaller' +assert mojo.requirements.requirement[0].'role-hint'.text() == 'test' +assert mojo.requirements.requirement[0].'field-name'.text() == 'custom' + +assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.api.plugin.Log' +assert mojo.requirements.requirement[1].'role-hint'.isEmpty() +assert mojo.requirements.requirement[1].'field-name'.text() == 'log' + +assert mojo.parameters.parameter.size() == 7 + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "basedir" }[0] +assert parameter.name.text() == 'basedir' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'java.nio.file.Path' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'false' +assert parameter.editable.text() == 'false' +assert parameter.description.text() == 'Project directory.' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0] +assert parameter.name.text() == 'touchFile' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'java.nio.file.Path' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'true' +assert parameter.editable.text() == 'true' +assert parameter.description.text() == '' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "mojo" }[0] +assert parameter.name.text() == 'mojo' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'org.apache.maven.api.MojoExecution' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'true' +assert parameter.editable.text() == 'false' +assert parameter.description.text() == '' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "namedParam" }[0] +assert parameter.name.text() == 'namedParam' +assert parameter.alias.text() == 'alias' +assert parameter.type.text() == 'java.lang.String' +assert parameter.since.text() == '0.1' +assert parameter.deprecated.text() == 'As of 0.2' +assert parameter.required.text() == 'false' +assert parameter.editable.text() == 'true' +assert parameter.description.text() == '' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "session" }[0] +assert parameter.name.text() == 'session' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'org.apache.maven.api.Session' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'true' +assert parameter.editable.text() == 'false' +assert parameter.description.text() == '' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "project" }[0] +assert parameter.name.text() == 'project' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'org.apache.maven.api.Project' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'true' +assert parameter.editable.text() == 'false' +assert parameter.description.text() == '' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "mojo" }[0] +assert parameter.name.text() == 'mojo' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'org.apache.maven.api.MojoExecution' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'true' +assert parameter.editable.text() == 'false' +assert parameter.description.text() == '' + +parameter = mojo.parameters.parameter.findAll{ it.name.text() == "settings" }[0] +assert parameter.name.text() == 'settings' +assert parameter.alias.isEmpty() +assert parameter.type.text() == 'org.apache.maven.api.settings.Settings' +assert parameter.since.isEmpty() +assert parameter.deprecated.isEmpty() +assert parameter.required.text() == 'true' +assert parameter.editable.text() == 'false' +assert parameter.description.text() == '' + +// check help mojo source and class +assert new File( basedir, "target/classes/org/apache/maven/its/v4api/HelpMojo.class" ).isFile() +assert new File( basedir, "target/generated-sources/plugin/org/apache/maven/its/v4api/HelpMojo.java" ).isFile() + +return true; diff --git a/maven-plugin-report-plugin/pom.xml b/maven-plugin-report-plugin/pom.xml index 24342904f..f07bfa6c5 100644 --- a/maven-plugin-report-plugin/pom.xml +++ b/maven-plugin-report-plugin/pom.xml @@ -23,7 +23,7 @@ maven-plugin-tools org.apache.maven.plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT org.apache.maven.plugins @@ -100,7 +100,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml b/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml index 2f4bf8514..2dd098795 100644 --- a/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml +++ b/maven-plugin-report-plugin/src/it/fix-maven-since-3.x/pom.xml @@ -34,9 +34,14 @@ javasample-maven-plugin + + 1.8 + 1.8 + + - org.codehaus.plexus + org.apache.maven plexus-utils @plexusUtilsVersion@ diff --git a/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java b/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java index 9eabcd550..24c7a418a 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java +++ b/maven-plugin-report-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java @@ -195,11 +195,10 @@ static class PluginOverviewRenderer private final Locale locale; /** - * @param project not null * @param sink not null * @param locale not null */ - public PluginOverviewRenderer( Sink sink, Locale locale ) + PluginOverviewRenderer( Sink sink, Locale locale ) { super( sink ); diff --git a/maven-plugin-report-plugin/src/it/plugin-report/pom.xml b/maven-plugin-report-plugin/src/it/plugin-report/pom.xml index 424ecec82..dd95249a0 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report/pom.xml +++ b/maven-plugin-report-plugin/src/it/plugin-report/pom.xml @@ -34,6 +34,8 @@ under the License. UTF-8 + 1.8 + 1.8 diff --git a/maven-plugin-report-plugin/src/it/plugin-report/src/main/java/org/DummyReport.java b/maven-plugin-report-plugin/src/it/plugin-report/src/main/java/org/DummyReport.java index 302314dd9..bc0447e55 100644 --- a/maven-plugin-report-plugin/src/it/plugin-report/src/main/java/org/DummyReport.java +++ b/maven-plugin-report-plugin/src/it/plugin-report/src/main/java/org/DummyReport.java @@ -120,7 +120,7 @@ protected void executeReport( Locale locale ) { return; } - if (skip || skipReport) + if ( skip || skipReport ) { getLog().info( "Maven Plugin Plugin Report generation skipped." ); return; @@ -181,12 +181,10 @@ static class PluginOverviewRenderer private final Locale locale; /** - * @param project not null * @param sink not null * @param locale not null */ - public PluginOverviewRenderer( Sink sink, - Locale locale ) + PluginOverviewRenderer( Sink sink, Locale locale ) { super( sink ); diff --git a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java index 01810881a..5d7427901 100644 --- a/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java +++ b/maven-plugin-report-plugin/src/main/java/org/apache/maven/plugins/plugin/descriptor/EnhancedPluginDescriptorBuilder.java @@ -32,6 +32,10 @@ import java.io.Reader; import java.net.URI; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Reads enhanced plugin.xml files as generated by @@ -90,11 +94,14 @@ public MojoDescriptor buildComponentDescriptor( PlexusConfiguration c, PluginDes PlexusConfiguration[] parameterConfigurations = c.getChild( "parameters" ).getChildren( "parameter" ); + List parameters = new ArrayList<>( mojoDescriptor.getParameters() ); + Map parameterMap = new LinkedHashMap<>( mojoDescriptor.getParameterMap() ); + for ( PlexusConfiguration d : parameterConfigurations ) { String parameterName = d.getChild( "name" ).getValue(); // don't call getParameterMap() to not populate - Parameter pd = mojoDescriptor.getParameterMap().get( parameterName ); + Parameter pd = parameterMap.get( parameterName ); if ( requireAddingMissingParameterSinceField ) { addMissingParameterSinceField( pd, d ); @@ -105,10 +112,19 @@ public MojoDescriptor buildComponentDescriptor( PlexusConfiguration c, PluginDes String parameterTypeJavadocUrl = configTypeJavadocUrl.getValue(); EnhancedParameterWrapper enhancedParameter = new EnhancedParameterWrapper( pd ); enhancedParameter.setTypeJavadocUrl( URI.create( parameterTypeJavadocUrl ) ); - mojoDescriptor.getParameters().set( mojoDescriptor.getParameters().indexOf( pd ), enhancedParameter ); - mojoDescriptor.getParameterMap().put( parameterName, enhancedParameter ); + parameters.set( mojoDescriptor.getParameters().indexOf( pd ), enhancedParameter ); + parameterMap.put( parameterName, enhancedParameter ); } } + + // clear() is required for maven < 3.6.2 + mojoDescriptor.getParameters().clear(); + // set parameters + mojoDescriptor.setParameters( parameters ); + // on maven < 3.6.2, getParameterMap is kept internally in a field + // so update it in case we're on an old maven version + mojoDescriptor.getParameterMap().putAll( parameterMap ); + return mojoDescriptor; } diff --git a/maven-plugin-tools-annotations/pom.xml b/maven-plugin-tools-annotations/pom.xml index 1830d6698..7d4a2130c 100644 --- a/maven-plugin-tools-annotations/pom.xml +++ b/maven-plugin-tools-annotations/pom.xml @@ -22,7 +22,7 @@ org.apache.maven.plugin-tools maven-plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-annotations @@ -61,7 +61,7 @@ slf4j-api - org.codehaus.plexus + org.apache.maven plexus-utils @@ -151,6 +151,10 @@ + + org.apache.maven.plugins + maven-compiler-plugin + diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java index 75b86560b..f7078e862 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java @@ -495,8 +495,22 @@ private DocletTag findInClassHierarchy( JavaClass javaClass, String tagName ) } catch ( NoClassDefFoundError e ) { - getLogger().warn( "Failed extracting tag '" + tagName + "' from class " + javaClass ); - throw e; + if ( e.getMessage().replace( '/', '.' ) + .contains( MojoAnnotationsScanner.V4_API_PLUGIN_PACKAGE ) ) + { + return null; + } + String str; + try + { + str = javaClass.getFullyQualifiedName(); + } + catch ( Throwable t ) + { + str = javaClass.getValue(); + } + getLogger().warn( "Failed extracting tag '" + tagName + "' from class " + str ); + throw (NoClassDefFoundError) new NoClassDefFoundError( e.getMessage() ).initCause( e ); } } @@ -599,8 +613,22 @@ private Map extractMethodsAnnotations( JavaClass j } catch ( NoClassDefFoundError e ) { - getLogger().warn( "Failed extracting methods from " + javaClass ); - throw e; + if ( e.getMessage().replace( '/', '.' ) + .contains( MojoAnnotationsScanner.V4_API_PLUGIN_PACKAGE ) ) + { + return new TreeMap<>(); + } + String str; + try + { + str = javaClass.getFullyQualifiedName(); + } + catch ( Throwable t ) + { + str = javaClass.getValue(); + } + getLogger().warn( "Failed extracting methods from " + str ); + throw (NoClassDefFoundError) new NoClassDefFoundError( e.getMessage() ).initCause( e ); } } @@ -760,6 +788,8 @@ private List toMojoDescriptors( Map mojoDescriptor.setImplementation( mojoAnnotatedClass.getClassName() ); mojoDescriptor.setLanguage( "java" ); + mojoDescriptor.setV4Api( mojoAnnotatedClass.isV4Api() ); + MojoAnnotationContent mojo = mojoAnnotatedClass.getMojo(); mojoDescriptor.setDescription( mojo.getDescription() ); diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java index b499428cb..1d850e4cb 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java @@ -27,7 +27,9 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.regex.Pattern; @@ -68,6 +70,17 @@ public class DefaultMojoAnnotationsScanner extends AbstractLogEnabled implements MojoAnnotationsScanner { + public static final String MVN4_API = "org.apache.maven.api.plugin.annotations."; + public static final String MOJO_V4 = MVN4_API + "Mojo"; + public static final String EXECUTE_V4 = MVN4_API + "Execute"; + public static final String PARAMETER_V4 = MVN4_API + "Parameter"; + public static final String COMPONENT_V4 = MVN4_API + "Component"; + + public static final String MOJO_V3 = Mojo.class.getName(); + public static final String EXECUTE_V3 = Execute.class.getName(); + public static final String PARAMETER_V3 = Parameter.class.getName(); + public static final String COMPONENT_V3 = Component.class.getName(); + // classes with a dash must be ignored private static final Pattern SCANNABLE_CLASS = Pattern.compile( "[^-]+\\.class" ); private static final String EMPTY = ""; @@ -86,8 +99,9 @@ public Map scan( MojoAnnotationsScannerRequest reque { scan( mojoAnnotatedClasses, dependency.getFile(), request.getIncludePatterns(), dependency, true ); if ( request.getMavenApiVersion() == null - && dependency.getArtifactId().equals( "maven-plugin-api" ) - && dependency.getGroupId().equals( "org.apache.maven" ) ) + && dependency.getGroupId().equals( "org.apache.maven" ) + && ( dependency.getArtifactId().equals( "maven-plugin-api" ) + || dependency.getArtifactId().equals( "maven-api-core" ) ) ) { request.setMavenApiVersion( dependency.getVersion() ); } @@ -281,7 +295,11 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor ) try { // @Mojo annotation - MojoAnnotationVisitor mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitor( Mojo.class ); + MojoAnnotationVisitor mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitor( MOJO_V3 ); + if ( mojoAnnotationVisitor == null ) + { + mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitor( MOJO_V4 ); + } if ( mojoAnnotationVisitor != null ) { MojoAnnotationContent mojoAnnotationContent = new MojoAnnotationContent(); @@ -296,7 +314,11 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor ) } // @Execute annotation - mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitor( Execute.class ); + mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitor( EXECUTE_V3 ); + if ( mojoAnnotationVisitor == null ) + { + mojoAnnotationVisitor = mojoClassVisitor.getAnnotationVisitor( EXECUTE_V4 ); + } if ( mojoAnnotationVisitor != null ) { ExecuteAnnotationContent executeAnnotationContent = new ExecuteAnnotationContent(); @@ -305,7 +327,8 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor ) } // @Parameter annotations - List mojoParameterVisitors = mojoClassVisitor.findParameterVisitors(); + List mojoParameterVisitors = mojoClassVisitor.findParameterVisitors( + new HashSet<>( Arrays.asList( PARAMETER_V3, PARAMETER_V4 ) ) ); for ( MojoParameterVisitor parameterVisitor : mojoParameterVisitors ) { ParameterAnnotationContent parameterAnnotationContent = @@ -314,9 +337,16 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor ) parameterVisitor.isAnnotationOnMethod() ); Map annotationVisitorMap = parameterVisitor.getAnnotationVisitorMap(); - MojoAnnotationVisitor fieldAnnotationVisitor = annotationVisitorMap.get( Parameter.class.getName() ); + MojoAnnotationVisitor fieldAnnotationVisitor = annotationVisitorMap.get( PARAMETER_V3 ); + if ( fieldAnnotationVisitor == null ) + { + fieldAnnotationVisitor = annotationVisitorMap.get( PARAMETER_V4 ); + } - populateAnnotationContent( parameterAnnotationContent, fieldAnnotationVisitor ); + if ( fieldAnnotationVisitor != null ) + { + populateAnnotationContent( parameterAnnotationContent, fieldAnnotationVisitor ); + } if ( annotationVisitorMap.containsKey( Deprecated.class.getName() ) ) { @@ -328,14 +358,19 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor ) } // @Component annotations - List mojoFieldVisitors = mojoClassVisitor.findFieldWithAnnotation( Component.class ); + List mojoFieldVisitors = mojoClassVisitor.findFieldWithAnnotation( + new HashSet<>( Arrays.asList( COMPONENT_V3, COMPONENT_V4 ) ) ); for ( MojoFieldVisitor mojoFieldVisitor : mojoFieldVisitors ) { ComponentAnnotationContent componentAnnotationContent = new ComponentAnnotationContent( mojoFieldVisitor.getFieldName() ); Map annotationVisitorMap = mojoFieldVisitor.getAnnotationVisitorMap(); - MojoAnnotationVisitor annotationVisitor = annotationVisitorMap.get( Component.class.getName() ); + MojoAnnotationVisitor annotationVisitor = annotationVisitorMap.get( COMPONENT_V3 ); + if ( annotationVisitor == null ) + { + annotationVisitor = annotationVisitorMap.get( COMPONENT_V4 ); + } if ( annotationVisitor != null ) { diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotatedClass.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotatedClass.java index 951468391..f3a0d7cba 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotatedClass.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotatedClass.java @@ -59,6 +59,8 @@ public class MojoAnnotatedClass */ private Artifact artifact; + private boolean v4Api; + public MojoAnnotatedClass() { // no op @@ -164,6 +166,16 @@ public boolean hasAnnotations() return !( getComponents().isEmpty() && getParameters().isEmpty() && execute == null && mojo == null ); } + public boolean isV4Api() + { + return v4Api; + } + + public void setV4Api( boolean v4Api ) + { + this.v4Api = v4Api; + } + @Override public String toString() { @@ -176,6 +188,7 @@ public String toString() sb.append( ", execute=" ).append( execute ); sb.append( ", parameters=" ).append( parameters ); sb.append( ", components=" ).append( components ); + sb.append( ", v4api=" ).append( v4Api ); sb.append( '}' ); return sb.toString(); } diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java index e1eb5f357..3795afe9d 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java @@ -37,16 +37,25 @@ public interface MojoAnnotationsScanner { String ROLE = MojoAnnotationsScanner.class.getName(); + String V4_API_PLUGIN_PACKAGE = "org.apache.maven.api.plugin"; + + String V4_API_ANNOTATIONS_PACKAGE = V4_API_PLUGIN_PACKAGE + ".annotations"; + List CLASS_LEVEL_ANNOTATIONS = Arrays.asList( Mojo.class.getName(), Execute.class.getName(), - Deprecated.class.getName() ); + Deprecated.class.getName(), + V4_API_ANNOTATIONS_PACKAGE + ".Mojo", + V4_API_ANNOTATIONS_PACKAGE + ".Execute" ); List FIELD_LEVEL_ANNOTATIONS = Arrays.asList( Parameter.class.getName(), Component.class.getName(), - Deprecated.class.getName() ); + Deprecated.class.getName(), + V4_API_ANNOTATIONS_PACKAGE + ".Parameter", + V4_API_ANNOTATIONS_PACKAGE + ".Component" ); List METHOD_LEVEL_ANNOTATIONS = Arrays.asList( Parameter.class.getName(), - Deprecated.class.getName() ); + Deprecated.class.getName(), + V4_API_ANNOTATIONS_PACKAGE + ".Parameter" ); /** * Scan classes for mojo annotations. diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java index 359cda68f..d22364d2d 100644 --- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java +++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java @@ -23,12 +23,13 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.tools.plugin.extractor.annotations.scanner.MojoAnnotatedClass; import org.apache.maven.tools.plugin.extractor.annotations.scanner.MojoAnnotationsScanner; import org.codehaus.plexus.util.StringUtils; @@ -41,6 +42,9 @@ import org.objectweb.asm.signature.SignatureReader; import org.objectweb.asm.util.TraceSignatureVisitor; +import static org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.PARAMETER_V3; +import static org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.PARAMETER_V4; + /** * Visitor for Mojo classes. * @@ -77,28 +81,48 @@ public int getVersion() public MojoAnnotationVisitor getAnnotationVisitor( Class annotation ) { - return annotationVisitorMap.get( annotation.getName() ); + return getAnnotationVisitor( annotation.getName() ); + } + + public MojoAnnotationVisitor getAnnotationVisitor( String name ) + { + return annotationVisitorMap.get( name ); } public List findFieldWithAnnotation( Class annotation ) { - String annotationClassName = annotation.getName(); + return findFieldWithAnnotation( Collections.singleton( annotation.getName() ) ); + } + + public List findFieldWithAnnotation( Set annotationClassNames ) + { + List mojoFieldVisitors = new ArrayList(); - return fieldVisitors.stream() - .filter( field -> field.getAnnotationVisitorMap().containsKey( annotationClassName ) ) - .collect( Collectors.toList() ); + for ( MojoFieldVisitor mojoFieldVisitor : this.fieldVisitors ) + { + Map filedVisitorMap = mojoFieldVisitor.getAnnotationVisitorMap(); + if ( filedVisitorMap.keySet().stream().anyMatch( annotationClassNames::contains ) ) + { + mojoFieldVisitors.add( mojoFieldVisitor ); + } + } + + return mojoFieldVisitors; } public List findParameterVisitors() { - String annotationClassName = Parameter.class.getName(); - - return Stream - .concat( - findFieldWithAnnotation( Parameter.class ).stream(), - methodVisitors.stream() - .filter( method -> method.getAnnotationVisitorMap().containsKey( annotationClassName ) ) ) - .collect( Collectors.toList() ); + return findParameterVisitors( new HashSet<>( Arrays.asList( PARAMETER_V3, PARAMETER_V4 ) ) ); + } + + public List findParameterVisitors( Set annotationClassNames ) + { + return Stream.concat( + findFieldWithAnnotation( annotationClassNames ).stream(), + methodVisitors.stream() + .filter( method -> method.getAnnotationVisitorMap().keySet().stream() + .anyMatch( annotationClassNames::contains ) ) ) + .collect( Collectors.toList() ); } @Override @@ -121,6 +145,10 @@ public AnnotationVisitor visitAnnotation( String desc, boolean visible ) { return null; } + if ( annotationClassName.startsWith( MojoAnnotationsScanner.V4_API_ANNOTATIONS_PACKAGE ) ) + { + mojoAnnotatedClass.setV4Api( true ); + } MojoAnnotationVisitor mojoAnnotationVisitor = new MojoAnnotationVisitor( annotationClassName ); annotationVisitorMap.put( annotationClassName, mojoAnnotationVisitor ); return mojoAnnotationVisitor; diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java index 9211afa20..970959e9e 100644 --- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java +++ b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/FooMojo.java @@ -23,7 +23,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -113,7 +112,7 @@ public static void setStaticMethod( String value ) @Override public void execute() - throws MojoExecutionException, MojoFailureException + throws MojoExecutionException { // nothing } diff --git a/maven-plugin-tools-api/pom.xml b/maven-plugin-tools-api/pom.xml index 523fde74c..e272f1bd1 100644 --- a/maven-plugin-tools-api/pom.xml +++ b/maven-plugin-tools-api/pom.xml @@ -25,7 +25,7 @@ org.apache.maven.plugin-tools maven-plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-api @@ -57,7 +57,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java index 0ab5b439f..f52f61d30 100644 --- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java +++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/ExtendedMojoDescriptor.java @@ -33,6 +33,7 @@ public class ExtendedMojoDescriptor extends MojoDescriptor { private final boolean containsXhtmlTextValues; + private boolean v4Api; public ExtendedMojoDescriptor() { @@ -60,6 +61,16 @@ public boolean containsXhtmlTextValues() return containsXhtmlTextValues; } + public boolean isV4Api() + { + return v4Api; + } + + public void setV4Api( boolean v4Api ) + { + this.v4Api = v4Api; + } + @Override public int hashCode() { diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java index e0425dd93..aefb8a8eb 100644 --- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java +++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java @@ -63,7 +63,14 @@ private PluginUtils() mavenComponents.put( "org.apache.maven.plugin.MojoExecution", "${mojoExecution}" ); mavenComponents.put( "org.apache.maven.plugin.descriptor.PluginDescriptor", "${plugin}" ); mavenComponents.put( "org.apache.maven.settings.Settings", "${settings}" ); - + + mavenComponents.put( "org.apache.maven.api.Session", "${session}" ); + mavenComponents.put( "org.apache.maven.api.Project", "${project}" ); + mavenComponents.put( "org.apache.maven.api.MojoExecution", "${mojoExecution}" ); + // TODO: apiv4: add PluginDescriptor to the api ? + //mavenComponents.put( "org.apache.maven.api.descriptor.PluginDescriptor", "${plugin}" ); + mavenComponents.put( "org.apache.maven.api.settings.Settings", "${settings}" ); + MAVEN_COMPONENTS = Collections.unmodifiableMap( mavenComponents ); } diff --git a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/stubs/MojoStub.java b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/stubs/MojoStub.java index f271b0092..d7f429863 100644 --- a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/stubs/MojoStub.java +++ b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/stubs/MojoStub.java @@ -23,7 +23,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; /** @@ -32,13 +31,6 @@ public class MojoStub extends AbstractMojo { - /** {@inheritDoc} */ - @Override - public Log getLog() - { - return super.getLog(); - } - /** {@inheritDoc} */ @Override public Map getPluginContext() @@ -46,13 +38,6 @@ public Map getPluginContext() return super.getPluginContext(); } - /** {@inheritDoc} */ - @Override - public void setLog( Log log ) - { - super.setLog( log ); - } - /** {@inheritDoc} */ @Override public void setPluginContext( Map pluginContext ) @@ -60,47 +45,10 @@ public void setPluginContext( Map pluginContext ) super.setPluginContext( pluginContext ); } - /** {@inheritDoc} */ - @Override - protected Object clone() - throws CloneNotSupportedException - { - return super.clone(); - } - - /** {@inheritDoc} */ - @Override - public boolean equals( Object obj ) - { - return super.equals( obj ); - } - - /** {@inheritDoc} */ - @Override - protected void finalize() - throws Throwable - { - super.finalize(); - } - - /** {@inheritDoc} */ - @Override - public int hashCode() - { - return super.hashCode(); - } - - /** {@inheritDoc} */ - @Override - public String toString() - { - return super.toString(); - } - /** {@inheritDoc} */ @Override public void execute() - throws MojoExecutionException, MojoFailureException + throws MojoExecutionException { } diff --git a/maven-plugin-tools-generators/pom.xml b/maven-plugin-tools-generators/pom.xml index 3ad4365f7..438749441 100644 --- a/maven-plugin-tools-generators/pom.xml +++ b/maven-plugin-tools-generators/pom.xml @@ -25,7 +25,7 @@ org.apache.maven.plugin-tools maven-plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-generators @@ -56,7 +56,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java index 493a1eba2..f00ca5e65 100644 --- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java +++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java @@ -463,6 +463,13 @@ protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w } GeneratorUtils.element( w, "threadSafe", String.valueOf( extendedMojoDescriptor.isThreadSafe() ) ); + + boolean v4Api = extendedMojoDescriptor.isV4Api(); + if ( v4Api ) + { + GeneratorUtils.element( w, "v4Api", String.valueOf( v4Api ) ); + } + } // ---------------------------------------------------------------------- diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java index 49174e51d..2436b9827 100644 --- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java +++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginHelpGenerator.java @@ -57,6 +57,7 @@ public class PluginHelpGenerator private String helpPackageName; private String goalPrefix; private MavenProject mavenProject; + private boolean useMaven4Api; private VelocityComponent velocityComponent; /** @@ -76,6 +77,10 @@ public void execute( File destinationDirectory ) { String helpImplementation = getImplementation(); + useMaven4Api = mavenProject.getDependencies().stream() + .anyMatch( dep -> "org.apache.maven".equals( dep.getGroupId() ) + && "maven-api-core".equals( dep.getArtifactId() ) ); + try { String sourcePath = helpImplementation.replace( '.', File.separatorChar ) + ".java"; @@ -142,8 +147,8 @@ private String getHelpClassSources( String pluginHelpPath ) StringWriter stringWriter = new StringWriter(); // plugin-tools sources are UTF-8 (and even ASCII in this case)) - try ( InputStream is = // - Thread.currentThread().getContextClassLoader().getResourceAsStream( "help-class-source.vm" ); // + try ( InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( + useMaven4Api ? "help-class-source-v4.vm" : "help-class-source.vm" ); // InputStreamReader isReader = new InputStreamReader( is, UTF_8 ) ) { //isReader = diff --git a/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm b/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm new file mode 100644 index 000000000..4b2ba5084 --- /dev/null +++ b/maven-plugin-tools-generators/src/main/resources/help-class-source-v4.vm @@ -0,0 +1,464 @@ +## 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. +#if ($helpPackageName.length()>0) +package ${helpPackageName}; +#end + +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.Component; +import org.apache.maven.api.plugin.annotations.Mojo; +import org.apache.maven.api.plugin.annotations.Parameter; +import org.apache.maven.api.plugin.Log; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +/** + * Display help information on ${artifactId}.
+ * Call mvn ${goalPrefix}:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. + * @author maven-plugin-tools + */ +@Mojo( name = "help", requiresProject = false ) +public class HelpMojo + implements org.apache.maven.api.plugin.Mojo +{ + @Component + private Log logger; + + /** + * If true, display all settable properties for each goal. + */ + @Parameter( property = "detail", defaultValue = "false" ) + private boolean detail; + + /** + * The name of the goal for which to show help. If unspecified, all goals will be displayed. + */ + @Parameter( property = "goal" ) + private java.lang.String goal; + + /** + * The maximum length of a display line, should be positive. + */ + @Parameter( property = "lineLength", defaultValue = "80" ) + private int lineLength; + + /** + * The number of spaces per indentation level, should be positive. + */ + @Parameter( property = "indentSize", defaultValue = "2" ) + private int indentSize; + + // /META-INF/maven///plugin-help.xml + private static final String PLUGIN_HELP_PATH = + "/META-INF/maven/${pluginHelpPath}"; + + private static final int DEFAULT_LINE_LENGTH = 80; + + private Document build() + throws MojoException + { + logger.debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH ); + try ( InputStream is = getClass().getResourceAsStream( PLUGIN_HELP_PATH ) ) + { + if ( is == null ) + { + throw new MojoException( "Could not find plugin descriptor at " + PLUGIN_HELP_PATH ); + } + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + return dBuilder.parse( is ); + } + catch ( IOException e ) + { + throw new MojoException( e.getMessage(), e ); + } + catch ( ParserConfigurationException e ) + { + throw new MojoException( e.getMessage(), e ); + } + catch ( SAXException e ) + { + throw new MojoException( e.getMessage(), e ); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void execute() + throws MojoException + { + if ( lineLength <= 0 ) + { + logger.warn( "The parameter 'lineLength' should be positive, using '80' as default." ); + lineLength = DEFAULT_LINE_LENGTH; + } + if ( indentSize <= 0 ) + { + logger.warn( "The parameter 'indentSize' should be positive, using '2' as default." ); + indentSize = 2; + } + + Document doc = build(); + + StringBuilder sb = new StringBuilder(); + Node plugin = getSingleChild( doc, "plugin" ); + + + String name = getValue( plugin, "name" ); + String version = getValue( plugin, "version" ); + String id = getValue( plugin, "groupId" ) + ":" + getValue( plugin, "artifactId" ) + ":" + version; + if ( isNotEmpty( name ) && !name.contains( id ) ) + { + append( sb, name + " " + version, 0 ); + } + else + { + if ( isNotEmpty( name ) ) + { + append( sb, name, 0 ); + } + else + { + append( sb, id, 0 ); + } + } + append( sb, getValue( plugin, "description" ), 1 ); + append( sb, "", 0 ); + + //plugin + String goalPrefix = getValue( plugin, "goalPrefix" ); + + Node mojos1 = getSingleChild( plugin, "mojos" ); + + List mojos = findNamedChild( mojos1, "mojo" ); + + if ( goal == null || goal.length() <= 0 ) + { + append( sb, "This plugin has " + mojos.size() + ( mojos.size() > 1 ? " goals:" : " goal:" ), 0 ); + append( sb, "", 0 ); + } + + for ( Node mojo : mojos ) + { + writeGoal( sb, goalPrefix, (Element) mojo ); + } + + if ( logger.isInfoEnabled() ) + { + logger.info( sb.toString() ); + } + } + + + private static boolean isNotEmpty( String string ) + { + return string != null && string.length() > 0; + } + + private static String getValue( Node node, String elementName ) + throws MojoException + { + return getSingleChild( node, elementName ).getTextContent(); + } + + private static Node getSingleChild( Node node, String elementName ) + throws MojoException + { + List namedChild = findNamedChild( node, elementName ); + if ( namedChild.isEmpty() ) + { + throw new MojoException( "Could not find " + elementName + " in plugin-help.xml" ); + } + if ( namedChild.size() > 1 ) + { + throw new MojoException( "Multiple " + elementName + " in plugin-help.xml" ); + } + return namedChild.get( 0 ); + } + + private static List findNamedChild( Node node, String elementName ) + { + List result = new ArrayList(); + NodeList childNodes = node.getChildNodes(); + for ( int i = 0; i < childNodes.getLength(); i++ ) + { + Node item = childNodes.item( i ); + if ( elementName.equals( item.getNodeName() ) ) + { + result.add( item ); + } + } + return result; + } + + private static Node findSingleChild( Node node, String elementName ) + throws MojoException + { + List elementsByTagName = findNamedChild( node, elementName ); + if ( elementsByTagName.isEmpty() ) + { + return null; + } + if ( elementsByTagName.size() > 1 ) + { + throw new MojoException( "Multiple " + elementName + "in plugin-help.xml" ); + } + return elementsByTagName.get( 0 ); + } + + private void writeGoal( StringBuilder sb, String goalPrefix, Element mojo ) + throws MojoException + { + String mojoGoal = getValue( mojo, "goal" ); + Node configurationElement = findSingleChild( mojo, "configuration" ); + Node description = findSingleChild( mojo, "description" ); + if ( goal == null || goal.length() <= 0 || mojoGoal.equals( goal ) ) + { + append( sb, goalPrefix + ":" + mojoGoal, 0 ); + Node deprecated = findSingleChild( mojo, "deprecated" ); + if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) ) + { + append( sb, "Deprecated. " + deprecated.getTextContent(), 1 ); + if ( detail && description != null ) + { + append( sb, "", 0 ); + append( sb, description.getTextContent(), 1 ); + } + } + else if ( description != null ) + { + append( sb, description.getTextContent(), 1 ); + } + append( sb, "", 0 ); + + if ( detail ) + { + Node parametersNode = getSingleChild( mojo, "parameters" ); + List parameters = findNamedChild( parametersNode, "parameter" ); + append( sb, "Available parameters:", 1 ); + append( sb, "", 0 ); + + for ( Node parameter : parameters ) + { + writeParameter( sb, parameter, configurationElement ); + } + } + } + } + + private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement ) + throws MojoException + { + String parameterName = getValue( parameter, "name" ); + String parameterDescription = getValue( parameter, "description" ); + + Element fieldConfigurationElement = null; + if ( configurationElement != null ) + { + fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName ); + } + + String parameterDefaultValue = ""; + if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) ) + { + parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")"; + } + append( sb, parameterName + parameterDefaultValue, 2 ); + Node deprecated = findSingleChild( parameter, "deprecated" ); + if ( ( deprecated != null ) && isNotEmpty( deprecated.getTextContent() ) ) + { + append( sb, "Deprecated. " + deprecated.getTextContent(), 3 ); + append( sb, "", 0 ); + } + append( sb, parameterDescription, 3 ); + if ( "true".equals( getValue( parameter, "required" ) ) ) + { + append( sb, "Required: Yes", 3 ); + } + if ( ( fieldConfigurationElement != null ) && isNotEmpty( fieldConfigurationElement.getTextContent() ) ) + { + String property = getPropertyFromExpression( fieldConfigurationElement.getTextContent() ); + append( sb, "User property: " + property, 3 ); + } + + append( sb, "", 0 ); + } + + /** + *

Repeat a String n times to form a new string.

+ * + * @param str String to repeat + * @param repeat number of times to repeat str + * @return String with repeated String + * @throws NegativeArraySizeException if repeat < 0 + * @throws NullPointerException if str is null + */ + private static String repeat( String str, int repeat ) + { + StringBuilder buffer = new StringBuilder( repeat * str.length() ); + + for ( int i = 0; i < repeat; i++ ) + { + buffer.append( str ); + } + + return buffer.toString(); + } + + /** + * Append a description to the buffer by respecting the indentSize and lineLength parameters. + * Note: The last character is always a new line. + * + * @param sb The buffer to append the description, not null. + * @param description The description, not null. + * @param indent The base indentation level of each line, must not be negative. + */ + private void append( StringBuilder sb, String description, int indent ) + { + for ( String line : toLines( description, indent, indentSize, lineLength ) ) + { + sb.append( line ).append( '\n' ); + } + } + + /** + * Splits the specified text into lines of convenient display length. + * + * @param text The text to split into lines, must not be null. + * @param indent The base indentation level of each line, must not be negative. + * @param indentSize The size of each indentation, must not be negative. + * @param lineLength The length of the line, must not be negative. + * @return The sequence of display lines, never null. + * @throws NegativeArraySizeException if indent < 0 + */ + private static List toLines( String text, int indent, int indentSize, int lineLength ) + { + List lines = new ArrayList(); + + String ind = repeat( "\t", indent ); + + String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); + + for ( String plainLine : plainLines ) + { + toLines( lines, ind + plainLine, indentSize, lineLength ); + } + + return lines; + } + + /** + * Adds the specified line to the output sequence, performing line wrapping if necessary. + * + * @param lines The sequence of display lines, must not be null. + * @param line The line to add, must not be null. + * @param indentSize The size of each indentation, must not be negative. + * @param lineLength The length of the line, must not be negative. + */ + private static void toLines( List lines, String line, int indentSize, int lineLength ) + { + int lineIndent = getIndentLevel( line ); + StringBuilder buf = new StringBuilder( 256 ); + + String[] tokens = line.split( " +" ); + + for ( String token : tokens ) + { + if ( buf.length() > 0 ) + { + if ( buf.length() + token.length() >= lineLength ) + { + lines.add( buf.toString() ); + buf.setLength( 0 ); + buf.append( repeat( " ", lineIndent * indentSize ) ); + } + else + { + buf.append( ' ' ); + } + } + + for ( int j = 0; j < token.length(); j++ ) + { + char c = token.charAt( j ); + if ( c == '\t' ) + { + buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); + } + else if ( c == '\u00A0' ) + { + buf.append( ' ' ); + } + else + { + buf.append( c ); + } + } + } + lines.add( buf.toString() ); + } + + /** + * Gets the indentation level of the specified line. + * + * @param line The line whose indentation level should be retrieved, must not be null. + * @return The indentation level of the line. + */ + private static int getIndentLevel( String line ) + { + int level = 0; + for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) + { + level++; + } + for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) + { + if ( line.charAt( i ) == '\t' ) + { + level++; + break; + } + } + return level; + } + + private static String getPropertyFromExpression( String expression ) + { + if ( expression != null && expression.startsWith( "${" ) && expression.endsWith( "}" ) + && !expression.substring( 2 ).contains( "${" ) ) + { + // expression="${xxx}" -> property="xxx" + return expression.substring( 2, expression.length() - 1 ); + } + // no property can be extracted + return null; + } +} diff --git a/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java b/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java index c51406d1f..12444b841 100644 --- a/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java +++ b/maven-plugin-tools-generators/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java @@ -101,20 +101,10 @@ public void testGenerator() MavenProject mavenProject = new MavenProject(); mavenProject.setGroupId( "foo" ); mavenProject.setArtifactId( "bar" ); - mavenProject.setBuild( new Build() - { - @Override - public String getDirectory() - { - return basedir + "/target"; - } - - @Override - public String getOutputDirectory() - { - return basedir + "/target"; - } - } ); + Build build = new Build(); + build.setDirectory( basedir + "/target" ); + build.setOutputDirectory( basedir + "/target" ); + mavenProject.setBuild( build ); extendPluginDescriptor( pluginDescriptor ); generator.execute( destinationDirectory, new DefaultPluginToolsRequest( mavenProject, pluginDescriptor ) ); diff --git a/maven-plugin-tools-java/pom.xml b/maven-plugin-tools-java/pom.xml index 4fb941b39..4481d9ec0 100644 --- a/maven-plugin-tools-java/pom.xml +++ b/maven-plugin-tools-java/pom.xml @@ -25,7 +25,7 @@ org.apache.maven.plugin-tools maven-plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-java @@ -52,7 +52,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java index 83bd3bf58..97af4b70d 100644 --- a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java +++ b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java @@ -86,14 +86,9 @@ private PluginToolsRequest createRequest( String directory ) model.setArtifactId( "maven-unitTesting-plugin" ); MavenProject project = new MavenProject( model ); - project.setBuild( new Build() - { - @Override - public String getDirectory() - { - return new File( "target" ).getAbsolutePath(); - } - } ); + Build build = new Build(); + build.setDirectory( new File( "target" ).getAbsolutePath() ); + project.setBuild( build ); project.setFile( new File( root, "pom.xml" ) ); project.addCompileSourceRoot( new File( root, directory ).getPath() ); diff --git a/maven-script/maven-plugin-tools-ant/pom.xml b/maven-script/maven-plugin-tools-ant/pom.xml index f1fc67db6..99221874f 100644 --- a/maven-script/maven-plugin-tools-ant/pom.xml +++ b/maven-script/maven-plugin-tools-ant/pom.xml @@ -25,7 +25,7 @@ org.apache.maven.plugin-tools maven-script - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-ant @@ -51,7 +51,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-script/maven-plugin-tools-beanshell/pom.xml b/maven-script/maven-plugin-tools-beanshell/pom.xml index 6e40d869a..6a958aac4 100644 --- a/maven-script/maven-plugin-tools-beanshell/pom.xml +++ b/maven-script/maven-plugin-tools-beanshell/pom.xml @@ -25,7 +25,7 @@ org.apache.maven.plugin-tools maven-script - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-beanshell diff --git a/maven-script/maven-plugin-tools-model/pom.xml b/maven-script/maven-plugin-tools-model/pom.xml index 4219c22f1..d02264644 100644 --- a/maven-script/maven-plugin-tools-model/pom.xml +++ b/maven-script/maven-plugin-tools-model/pom.xml @@ -25,7 +25,7 @@ org.apache.maven.plugin-tools maven-script - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin-tools-model @@ -41,7 +41,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils diff --git a/maven-script/maven-script-ant/pom.xml b/maven-script/maven-script-ant/pom.xml index cbba0e1f6..f46d93dca 100644 --- a/maven-script/maven-script-ant/pom.xml +++ b/maven-script/maven-script-ant/pom.xml @@ -23,7 +23,7 @@ under the License. org.apache.maven.plugin-tools maven-script - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-script-ant diff --git a/maven-script/maven-script-ant/src/main/java/org/apache/maven/script/ant/AntMojoWrapper.java b/maven-script/maven-script-ant/src/main/java/org/apache/maven/script/ant/AntMojoWrapper.java index 43c8620e1..aef75a446 100644 --- a/maven-script/maven-script-ant/src/main/java/org/apache/maven/script/ant/AntMojoWrapper.java +++ b/maven-script/maven-script-ant/src/main/java/org/apache/maven/script/ant/AntMojoWrapper.java @@ -223,8 +223,7 @@ private void addClasspathReferences() if ( mavenProject != null && session != null && pathTranslator != null ) { ExpressionEvaluator exprEvaluator = - new PluginParameterExpressionEvaluator( session, mojoExecution, pathTranslator, logger, - mavenProject, mavenProject.getProperties() ); + new PluginParameterExpressionEvaluator( session, mojoExecution ); PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper( antProject ); propertyHelper.setNext( new AntPropertyHelper( exprEvaluator, mavenProject.getArtifacts(), getLog() ) ); diff --git a/maven-script/maven-script-beanshell/pom.xml b/maven-script/maven-script-beanshell/pom.xml index 9b7267d05..2d1132367 100644 --- a/maven-script/maven-script-beanshell/pom.xml +++ b/maven-script/maven-script-beanshell/pom.xml @@ -23,7 +23,7 @@ under the License. org.apache.maven.plugin-tools maven-script - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-script-beanshell diff --git a/maven-script/pom.xml b/maven-script/pom.xml index 6f3e12812..42bff3315 100644 --- a/maven-script/pom.xml +++ b/maven-script/pom.xml @@ -23,7 +23,7 @@ under the License. org.apache.maven.plugin-tools maven-plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-script diff --git a/pom.xml b/pom.xml index 0f3c18e65..b0ec9e2d8 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ org.apache.maven.plugin-tools maven-plugin-tools - 3.7.1-SNAPSHOT + 4.0.0-SNAPSHOT pom Maven Plugin Tools @@ -94,6 +94,7 @@ 8 3.3.0 + 4.0.0-alpha-2 3.2.5 @@ -106,9 +107,10 @@ 9.4 1.11.1 1.11.1 - 3.5.0 + 4.0.0-alpha-2 3.1.1 3.2.0 + 3.0.0-M7 2022-10-30T09:30:18Z @@ -237,7 +239,7 @@ - org.codehaus.plexus + org.apache.maven plexus-utils ${plexusUtilsVersion} @@ -369,6 +371,7 @@ org.apache.maven.plugins maven-surefire-plugin + ${surefire.version} false