Mikhail Deviatov commented on MCOMPILER-588:

I faced with a problem trying to apply native solution.
public class CompilerTest {

    @InjectMojo(goal = "compile", pom = 
    void testCompilerBasic(CompilerMojo compileMojo) throws Exception {         
 Log log = mock(Log.class);



        File testClass = new File(compileMojo.getOutputDirectory(), 

produce an error
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.015 s 
<<< FAILURE! – in org.apache.maven.plugin.compiler.CompilerTest
[ERROR] org.apache.maven.plugin.compiler.CompilerTest – Time elapsed: 0.015 s 
<<< ERROR!
java.lang.NoClassDefFoundError: org/apache/maven/api/xml/XmlNode

package with this class was intoduce in 4.0.0-alpha-2 version of maven


internal Maven API is still subject to change
switch to JUnit5 support was introduce in Maven version 3.5.4
later minimum version of Maven was increased to 3.6.3
now it requires 4.0.0-alpha-2 just to start a simple test.

do we really need to wait when API is stabilized?
my solution binds to internal API *maven-plugin-testing-harness* that is not 
gonna be subject to change for a very long time. Applying it we get JUnit5 
support right away. when internal maven API can be applied we can drop my 
solution in favor of native support.
what do you think about this approach?


> JUnit4 test framework to JUnit5 migration
> -----------------------------------------
>                 Key: MCOMPILER-588
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-588
>             Project: Maven Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Mikhail Deviatov
>            Priority: Major
> We have JUnit5 test framework for a long time. 
> It have modular architecture, good support in IDE and quite fast. It would be 
> good to add support JUnit5 to the project.
> The problem is that there are 2 library used for testing in project 
> *maven-plugin-testing-harness* and *org.eclipse.sisu.plexus* and they both 
> don't have JUnit5 support.
> I created a solution that overrides parts of code used derived and my own 
> implementation.
> Please take a look at it
> https://github.com/apache/maven-compiler-plugin/pull/233

This message was sent by Atlassian Jira

Reply via email to