You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Oliver Glowa (Jira)" <ji...@apache.org> on 2022/12/08 12:19:00 UTC

[jira] [Comment Edited] (MNG-7621) Parameter '-f' causes ignoring any 'maven.config' (only on Windows)

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

Oliver Glowa edited comment on MNG-7621 at 12/8/22 12:18 PM:
-------------------------------------------------------------

Ok,
what have I done:

Opened <MAVEN_HOME>\bin\mvn.cmd (Release 3.8.6)
Edit line 140
{noformat}
OLD:    if exist "%WDIR%\.mvn" goto baseDirFound
NEW:    if exist ".mvn" goto baseDirFound
{noformat}
Test with my example ([https://github.com/ollily/maven-test.git])
{noformat}
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] --- 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:  1.749 s
[INFO] Finished at: 2022-12-08T13:08:48+01:00
[INFO] ------------------------------------------------------------------------{noformat}
h3. C O R R E C T !
h1. Finally

I'm able to confirm, that this fix will solve the problem.

Thx, Oliver


was (Author: ollily):
Ok,
what have I done:

- Opened <MAVEN_HOME>\bin\mvn.cmd (Release 3.8.6)

- Edit line 140

 
{noformat}
OLD:    if exist "%WDIR%\.mvn" goto baseDirFound
NEW:    if exist ".mvn" goto baseDirFound
{noformat}
 

- Test with my example ([https://github.com/ollily/maven-test.git]) 
{noformat}
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] --- 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:  1.749 s
[INFO] Finished at: 2022-12-08T13:08:48+01:00
[INFO] ------------------------------------------------------------------------{noformat}
h3. C O R R E C T !
h1. Finally

I'm able to confirm, that this fix will solve the problem.

Thx, Oliver

> Parameter '-f' causes ignoring any 'maven.config' (only on Windows)
> -------------------------------------------------------------------
>
>                 Key: MNG-7621
>                 URL: https://issues.apache.org/jira/browse/MNG-7621
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.6.3, 3.8.6
>         Environment: Windows 10 64Bit EE
> Cygwin 64Bit
>            Reporter: Oliver Glowa
>            Assignee: Michael Osipov
>            Priority: Minor
>              Labels: maven
>             Fix For: 3.8.x-candidate, 3.9.0-candidate, 4.0.x-candidate
>
>
> 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]
> h1. 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.
> {noformat}
> 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] ------------------------------------------------------------------------
> {noformat}
>  
> When the filename is added, the "maven.config" will be recognized (the parameter in "maven.config" will activated the profile "profile1")
> {noformat}
> 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] ------------------------------------------------------------------------{noformat}
> h2. Additional
> The problem occurs only on a windows commandline, not under linux (cygwin) shell.
> h2. Test with
>  * Maven 3.6.3 / Maven 3.8.6
>  * OpenJDK 17
>  * Windows 10 64Bit
>  * Cygwin 64Bit
> {noformat}
> 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"
> {noformat}
> h2. Example
> An example project is added .
> {noformat}
> https://github.com/ollily/maven-test.git{noformat}
> call "build.bat" to see the different handling.
>  



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