[jira] [Commented] (MPLUGINTESTING-84) Support JUnit 5 on Maven 3
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776717#comment-17776717 ] ASF GitHub Bot commented on MPLUGINTESTING-84: -- gnodet merged PR #31: URL: https://github.com/apache/maven-plugin-testing/pull/31 > Support JUnit 5 on Maven 3 > -- > > Key: MPLUGINTESTING-84 > URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-84 > Project: Maven Plugin Testing > Issue Type: New Feature >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-2 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MPLUGINTESTING-84) Support JUnit 5 on Maven 3
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776709#comment-17776709 ] ASF GitHub Bot commented on MPLUGINTESTING-84: -- slawekjaranowski commented on PR #31: URL: https://github.com/apache/maven-plugin-testing/pull/31#issuecomment-1768555976 Great > Support JUnit 5 on Maven 3 > -- > > Key: MPLUGINTESTING-84 > URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-84 > Project: Maven Plugin Testing > Issue Type: New Feature >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-2 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MPLUGINTESTING-84) Support JUnit 5 on Maven 3
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17733192#comment-17733192 ] ASF GitHub Bot commented on MPLUGINTESTING-84: -- gnodet commented on code in PR #31: URL: https://github.com/apache/maven-plugin-testing/pull/31#discussion_r1231374323 ## maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/junit5/MojoExtension.java: ## @@ -0,0 +1,426 @@ +/* + * 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. + */ +package org.apache.maven.plugin.testing.junit5; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.Reader; +import java.io.StringReader; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Field; +import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.google.inject.internal.ProviderMethodsModule; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.lifecycle.internal.MojoDescriptorCreator; +import org.apache.maven.plugin.Mojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.PluginParameterExpressionEvaluator; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.Parameter; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugin.testing.ConfigurationException; +import org.apache.maven.plugin.testing.MojoLogWrapper; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.DefaultPlexusContainer; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.component.configurator.BasicComponentConfigurator; +import org.codehaus.plexus.component.configurator.ComponentConfigurator; +import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; +import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; +import org.codehaus.plexus.component.configurator.expression.TypeAwareExpressionEvaluator; +import org.codehaus.plexus.component.repository.ComponentDescriptor; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; +import org.codehaus.plexus.testing.PlexusExtension; +import org.codehaus.plexus.util.InterpolationFilterReader; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.slf4j.LoggerFactory; + +/** Review Comment: Note that this class is a copy of the https://github.com/apache/maven-plugin-testing/blob/2641af2f47342384cfa61f637df3a2c1223d7e83/maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing/MojoExtension.java, so I'll modify both... > Support JUnit 5 on Maven 3 > -- > > Key: MPLUGINTESTING-84 > URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-84 > Project: Maven Plugin Testing > Issue Type: New Feature >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-2 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MPLUGINTESTING-84) Support JUnit 5 on Maven 3
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17733193#comment-17733193 ] ASF GitHub Bot commented on MPLUGINTESTING-84: -- gnodet commented on code in PR #31: URL: https://github.com/apache/maven-plugin-testing/pull/31#discussion_r1231374323 ## maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/junit5/MojoExtension.java: ## @@ -0,0 +1,426 @@ +/* + * 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. + */ +package org.apache.maven.plugin.testing.junit5; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.Reader; +import java.io.StringReader; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Field; +import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.google.inject.internal.ProviderMethodsModule; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.lifecycle.internal.MojoDescriptorCreator; +import org.apache.maven.plugin.Mojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.PluginParameterExpressionEvaluator; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.Parameter; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugin.testing.ConfigurationException; +import org.apache.maven.plugin.testing.MojoLogWrapper; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.DefaultPlexusContainer; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.component.configurator.BasicComponentConfigurator; +import org.codehaus.plexus.component.configurator.ComponentConfigurator; +import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; +import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; +import org.codehaus.plexus.component.configurator.expression.TypeAwareExpressionEvaluator; +import org.codehaus.plexus.component.repository.ComponentDescriptor; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; +import org.codehaus.plexus.testing.PlexusExtension; +import org.codehaus.plexus.util.InterpolationFilterReader; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.slf4j.LoggerFactory; + +/** Review Comment: Note that this class is a copy of the https://github.com/apache/maven-plugin-testing/blob/2641af2f47342384cfa61f637df3a2c1223d7e83/maven-plugin-testing-harness/src/main/java/org/apache/maven/api/plugin/testing/MojoExtension.java, modified to support maven 3 instead of maven 4, so I'll modify both... > Support JUnit 5 on Maven 3 > -- > > Key: MPLUGINTESTING-84 > URL: https://issues.apache.org/jira/browse/MPLUGINTESTING-84 > Project: Maven Plugin Testing > Issue Type: New Feature >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-2 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MPLUGINTESTING-84) Support JUnit 5 on Maven 3
[ https://issues.apache.org/jira/browse/MPLUGINTESTING-84?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17733180#comment-17733180 ] ASF GitHub Bot commented on MPLUGINTESTING-84: -- elharo commented on code in PR #31: URL: https://github.com/apache/maven-plugin-testing/pull/31#discussion_r1231341186 ## maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/junit5/MojoExtension.java: ## @@ -0,0 +1,426 @@ +/* + * 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. + */ +package org.apache.maven.plugin.testing.junit5; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.Reader; +import java.io.StringReader; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Field; +import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.google.inject.internal.ProviderMethodsModule; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.lifecycle.internal.MojoDescriptorCreator; +import org.apache.maven.plugin.Mojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.PluginParameterExpressionEvaluator; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.Parameter; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugin.testing.ConfigurationException; +import org.apache.maven.plugin.testing.MojoLogWrapper; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.DefaultPlexusContainer; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.component.configurator.BasicComponentConfigurator; +import org.codehaus.plexus.component.configurator.ComponentConfigurator; +import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; +import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; +import org.codehaus.plexus.component.configurator.expression.TypeAwareExpressionEvaluator; +import org.codehaus.plexus.component.repository.ComponentDescriptor; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; +import org.codehaus.plexus.testing.PlexusExtension; +import org.codehaus.plexus.util.InterpolationFilterReader; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.slf4j.LoggerFactory; + +/** + * + */ +public class MojoExtension extends PlexusExtension implements ParameterResolver { + +@Override +public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) +throws ParameterResolutionException { +return parameterContext.isAnnotated(InjectMojo.class) +|| parameterContext.getDeclaringExecutable().isAnnotationPresent(InjectMojo.class); +} + +@Override +public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) +throws ParameterResolutionException { +try { +InjectMojo injectMojo = parameterContext +.findAnnotation(InjectMojo.class) +.orElseGet(() -> parameterContext.getDeclaringExecutable().getAnnotation(InjectMojo.cl