[ 
https://issues.apache.org/jira/browse/SUREFIRE-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17799872#comment-17799872
 ] 

Michael Osipov commented on SUREFIRE-2223:
------------------------------------------

Here is the method in question:
{code:java}
    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        cli = commandLineOptions();
        // Stuff that should have been final
        setupStuff();
        Platform platform = 
PLATFORM.withJdkExecAttributesForTests(getEffectiveJvm());
        Thread shutdownThread = new Thread(platform::setShutdownState);
        addShutDownHook(shutdownThread);
        try {
            if (verifyParameters() && !hasExecutedBefore()) {
                DefaultScanResult scan = scanForTestClasses();
                if (!hasSuiteXmlFiles() && scan.isEmpty()) {
                    switch (getEffectiveFailIfNoTests()) {
                        case COULD_NOT_RUN_DEFAULT_TESTS:
                            throw new MojoFailureException(
                                    "No tests were executed!  (Set 
-DfailIfNoTests=false to ignore this error.)");
                        case COULD_NOT_RUN_SPECIFIED_TESTS:
                            throw new MojoFailureException("No tests matching 
pattern \""
                                    + getSpecificTests().toString()
                                    + "\" were executed! (Set "
                                    + "-D" + getPluginName()
                                    + ".failIfNoSpecifiedTests=false to ignore 
this error.)");
                        default:
                            handleSummary(noTestsRun(), null);
                            return;
                    }
                }
                logReportsDirectory();
                executeAfterPreconditionsChecked(scan, platform);
            }
        } finally {
            platform.clearShutdownState();
            removeShutdownHook(shutdownThread);
        }
    }
{code}

> Surefire evaluates parameter jvm before skip
> --------------------------------------------
>
>                 Key: SUREFIRE-2223
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2223
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>            Reporter: shpelda
>            Priority: Minor
>
> Surefire 3.2.3 execution configured like the one bellow will fail if 
> JAVA_11_HOME is not set.
> It is a regression, 2.17 version did correctly resolved skip(Tests) and 
> later, if enabled, it evaluated jvm.
> {code:java}
> <execution>
>               <id>h2-java11</id>
>               <goals>
>                 <goal>test</goal>
>               </goals>
>               <configuration>
>                 <jvm>${JAVA_11_HOME}/bin/java</jvm>
>                 <skip>true</skip>
>               </configuration>
>             </execution> 
> fails with
> {code}
> Caused by: org.apache.maven.plugin.MojoFailureException: Given path to java 
> executor does not exist "c:\XXX\${JAVA_11_HOME}\bin\java".
>     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.getEffectiveJvm 
> (AbstractSurefireMojo.java:2374)
>     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute 
> (AbstractSurefireMojo.java:882)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
> (DefaultBuildPluginManager.java:137)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:210)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:156)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
> (MojoExecutor.java:148)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:117)
>     at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
> (LifecycleModuleBuilder.java:81)
>     at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
>  (SingleThreadedBuilder.java:56)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
> (LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
> {code:java}
>  {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to