Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7621

Parameter '-f' causes ignoring any 'maven.config' (only on Windows)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.6.3, 3.8.6
    • 3.8.7, 3.9.0, 4.0.0-alpha-4, 4.0.0
    • Core
    • Windows 10 64Bit EE
      Cygwin 64Bit

    Description

      Hello,

      first of all, I didn't find a ticket, related to the possible bug I found (keyword "-f" and "maven.config")
      https://issues.apache.org/jira/issues/?jql=project%20%3D%20MNG%20AND%20text%20~%20maven.config%20AND%20text%20~%20-f

      Analysis

      Here the problem I found:

      When executing maven with parameter "-f" without a file name (e.g. "pom.xml") any ".mvn\maven.config" is ignored.

      C:\projects\projects_github>mvn -f maven-test clean verify
      [INFO] Scanning for projects...
      [INFO]
      [INFO] --------------------< com.glowanet.appl:maven-test >--------------------
      [INFO] Building maven-test 1.0-SNAPSHOT
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-test ---
      [INFO] Deleting C:\projects\projects_github\maven-test\target
      [INFO]
      [INFO] --- echo-maven-plugin:1.3.2:echo (echo-plugin) @ maven-test ---
      [INFO] plugin active
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-test ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-test ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to C:\projects\projects_github\maven-test\target\classes
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-test ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory C:\projects\projects_github\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] No tests to run.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven-test ---
      [INFO] Building jar: C:\projects\projects_github\maven-test\target\maven-test-1.0-SNAPSHOT.jar
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  2.063 s
      [INFO] Finished at: 2022-12-07T14:21:45+01:00
      [INFO] ------------------------------------------------------------------------
      
      

       

      When the filename is added, the "maven.config" will be recognized (the parameter in "maven.config" will activated the profile "profile1")

      C:\projects\projects_github>mvn -f maven-test\pom.xml clean verify
      [INFO] Scanning for projects...
      [INFO]
      [INFO] --------------------< com.glowanet.appl:maven-test >--------------------
      [INFO] Building maven-test 1.0-SNAPSHOT
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven-test ---
      [INFO] Deleting C:\projects\projects_github\maven-test\target
      [INFO]
      [INFO] --- maven-help-plugin:3.3.0:active-profiles (default) @ maven-test ---
      [INFO]
      Active Profiles for Project 'com.glowanet.appl:maven-test:jar:1.0-SNAPSHOT':
      
      The following profiles are active: 
      
      - profile1 (source: com.glowanet.appl:maven-test:1.0-SNAPSHOT)
      
      
      
      [INFO]
      [INFO] --- echo-maven-plugin:1.3.2:echo (echo-plugin) @ maven-test ---
      [INFO] plugin active
      [INFO]
      [INFO] --- echo-maven-plugin:1.3.2:echo (echo-profile) @ maven-test ---
      [INFO] profile1 active
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-test ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 0 resource
      [INFO]
      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-test ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to C:\projects\projects_github\maven-test\target\classes
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-test ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory C:\projects\projects_github\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] No tests to run.
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven-test ---
      [INFO] Building jar: C:\projects\projects_github\maven-test\target\maven-test-1.0-SNAPSHOT.jar
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  2.123 s
      [INFO] Finished at: 2022-12-07T14:22:26+01:00
      [INFO] ------------------------------------------------------------------------

      Additional

      The problem occurs only on a windows commandline, not under linux (cygwin) shell.

      Test with

      • Maven 3.6.3 / Maven 3.8.6
      • OpenJDK 17
      • Windows 10 64Bit
      • Cygwin 64Bit
      Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
      Maven home: C:\Programme-2\apache-maven\apache-maven\bin\..
      Java version: 17.0.4.1, vendor: Eclipse Adoptium, runtime: C:\Programme-2\openjdk\jdk
      Default locale: de_DE, platform encoding: Cp1252
      OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
      
      Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
      Maven home: C:\Programme-2\apache-maven\apache-maven-3.8.6
      Java version: 17.0.4.1, vendor: Eclipse Adoptium, runtime: C:\Programme-2\openjdk\jdk
      Default locale: de_DE, platform encoding: Cp1252
      OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
      

      Example

      An example project is added .

      https://github.com/ollily/maven-test.git

      call "build.bat" to see the different handling.

       

      Attachments

        Issue Links

          Activity

            People

              michael-o Michael Osipov
              ollily Oliver Glowa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: