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

Michael Osipov commented on MINVOKER-334:
-----------------------------------------

Let's leave this open, it may happen reliably again.

> incorrect basedir on windows
> ----------------------------
>
>                 Key: MINVOKER-334
>                 URL: https://issues.apache.org/jira/browse/MINVOKER-334
>             Project: Maven Invoker Plugin
>          Issue Type: Bug
>    Affects Versions: 3.5.0
>         Environment: Apache Maven 3.9.1 
> (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
> Maven home: c:\java\maven-3.9.1
> Java version: 11.0.15, vendor: Eclipse Adoptium, runtime: 
> c:\java\jdk-11.0.15+10
> Default locale: en_GB, platform encoding: Cp1252
> OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
>            Reporter: James Nord
>            Priority: Major
>
> When run on windows the pluigin munges the value of basedir to something that 
> is not correct.
> in windows the canonical case of a drive letter us upper case, and the file 
> system can be case sensitive but is nearly always always case preserving (on 
> NTFS)
> the plugin however lower cases the basedir leading to incorrect test results 
> when run on windows.
> jshell showing correct info
> {noformat}
> jshell> File f = new File(".").getCanonicalFile()
> f ==> C:\workarea\source\github\jenkinsci\maven-hpi-plugin
> jshell> Path p = f.toPath()
> p ==> C:\workarea\source\github\jenkinsci\maven-hpi-plugin
> jshell> p.toRealPath()
> $3 ==> C:\workarea\source\github\jenkinsci\maven-hpi-plugin
> {noformat}
> sample output from the invoker plugin
> {noformat}
> [INFO] --- invoker:3.5.0:install (integration-test) @ maven-hpi-plugin ---
> [INFO] Installing 
> c:\workarea\source\github\jenkinsci\maven-hpi-plugin\target\maven-hpi-plugin-3.42-SNAPSHOT.jar
>  to 
> c:\workarea\source\github\jenkinsci\maven-hpi-plugin\target\local-repo\org\jenkins-ci\tools\maven-hpi-plugin\3.42-SNAPSHOT\maven-hpi-plugin-3.42-SNAPSHOT.jar
> [INFO] Installing 
> c:\workarea\source\github\jenkinsci\maven-hpi-plugin\target\maven-hpi-plugin-3.42-SNAPSHOT.pom
>  to 
> c:\workarea\source\github\jenkinsci\maven-hpi-plugin\target\local-repo\org\jenkins-ci\tools\maven-hpi-plugin\3.42-SNAPSHOT\maven-hpi-plugin-3.42-SNAPSHOT.pom
> {noformat}
> this can also be observed in a {{verify.groovy}} script that is expecting a 
> specific output to be written in a log of a run plugin.
> {noformat}
> List lines = new File(basedir, 'plugins.txt').readLines('UTF-8')
> // invoker plugin is brain dead and sets incorrect path
> // like c:\foo\bar when it should be C:\foo\bar
> // so we need to canonicalize the basedir
> def projectRoot = basedir.getCanonicalPath() + File.separator
> assert lines.get(0).contains("$basedir")
> {noformat}
> which causes a failure like:
> {noformat}
> [INFO]   Assertion failed:
> assert lines.get(0).contains("${basedir}")
>        |     |      |           |
>        |     |      false       
> c:\workarea\source\github\jenkinsci\maven-hpi-plugin\target\its\list-plugins-aggregator
>        |     
> 'whizzbang\t1.0-SNAPSHOT\tC:\\workarea\\source\\github\\jenkinsci\\maven-hpi-plugin\\target\\its\\list-plugins-aggregator\\a-plugin'
>        
> ['whizzbang\t1.0-SNAPSHOT\tC:\\workarea\\source\\github\\jenkinsci\\maven-hpi-plugin\\target\\its\\list-plugins-aggregator\\a-plugin',
>  
> 'list-plugins-plugin1\t1.0-SNAPSHOT\tC:\\workarea\\source\\github\\jenkinsci\\maven-hpi-plugin\\target\\its\\list-plugins-aggregator\\first-module']
> {noformat}



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

Reply via email to