You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tamas Cservenak (Jira)" <ji...@apache.org> on 2023/03/07 07:08:00 UTC

[jira] [Comment Edited] (MNG-7718) Maven 3.9.0 auto detect test and download surefire-plugin

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

Tamas Cservenak edited comment on MNG-7718 at 3/7/23 7:07 AM:
--------------------------------------------------------------

Howdy, how do you invoke Maven? 

And as counter example, this same is happening (and is expected to happen) in Maven 3.8.7 as well, as seen here:
{noformat}
[cstamas@urnebes maven-test]$ mvn -V package
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /home/cstamas/.sdkman/candidates/maven/3.8.7
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /home/cstamas/.sdkman/candidates/java/17.0.6-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.1.14-200.fc37.x86_64", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< org.example:maven-test >-----------------------
[INFO] Building maven-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/cstamas/tmp/MNG-7718/maven-test/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-test ---
[INFO] Surefire report directory: /home/cstamas/tmp/MNG-7718/maven-test/target/surefire-reports-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running DataTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 secResults :Tests run: 0, Failures: 0, Errors: 0, Skipped: 0[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.678 s
[INFO] Finished at: 2023-03-07T08:02:23+01:00
[INFO] ------------------------------------------------------------------------
[cstamas@urnebes maven-test]$  {noformat}
So even with 3.8.7 the tests run.

If the problem is "downloads the surefire plugin", then yes, Maven 3.9.0 did upgrade the plugin version (MNG-7666), but your project does not lock down the plugin version (part of best practices), and Maven of any version would fallback to "its own" version when POM does not define versioned plugins. Hence the best practice, as otherwise your build is dependant from used Maven version (and it's implicit plugin versions). My wild guess is that your local repository contains surefire 2.12.4 but not the 3.0.0-M8.

In short, unsure what the problem is, as even Maven 3.8.7 "auto detects" and runs tests.


was (Author: cstamas):
Howdy, how do you invoke Maven? 

And as counter example, this same is happening (and is expected to happen) in Maven 3.8.7 as well, as seen here:
{noformat}
[cstamas@urnebes maven-test]$ mvn -V package
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /home/cstamas/.sdkman/candidates/maven/3.8.7
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /home/cstamas/.sdkman/candidates/java/17.0.6-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.1.14-200.fc37.x86_64", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< org.example:maven-test >-----------------------
[INFO] Building maven-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/cstamas/tmp/MNG-7718/maven-test/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-test ---
[INFO] Surefire report directory: /home/cstamas/tmp/MNG-7718/maven-test/target/surefire-reports-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running DataTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 secResults :Tests run: 0, Failures: 0, Errors: 0, Skipped: 0[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.678 s
[INFO] Finished at: 2023-03-07T08:02:23+01:00
[INFO] ------------------------------------------------------------------------
[cstamas@urnebes maven-test]$  {noformat}
So even with 3.8.7 the tests run.

If the problem is "downloads the surefire plugin", then yes, Maven 3.9.0 did upgrade the plugin version (MNG-7666), but your project does not lock down the plugin version (part of best practices), and Maven of any version would fallback to "its own" version when POM does not define versioned plugins. My wild guess is that your local repository contains surefire 2.12.4 but not the 3.0.0-M8.

In short, unsure what the problem is, as even Maven 3.8.7 "auto detects" and runs tests.

> Maven 3.9.0 auto detect test and download surefire-plugin
> ---------------------------------------------------------
>
>                 Key: MNG-7718
>                 URL: https://issues.apache.org/jira/browse/MNG-7718
>             Project: Maven
>          Issue Type: Dependency upgrade
>    Affects Versions: 3.9.0
>            Reporter: Durgesh Mishra
>            Priority: Minor
>              Labels: test-stability
>             Fix For: waiting-for-feedback, wontfix-candidate
>
>         Attachments: maven-test.zip
>
>
> After the maven version upgrade to 3.9.0, Automatically surefire plugin download and run the test case during build process.
> For this version we don't need to pass explicitly maven surefire plugin.
> Please let me know if this is expected or bug ? 
> Because i can't see any release notes regarding this feature.



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