broodjetom commented on PR #76:
URL: https://github.com/apache/maven-help-plugin/pull/76#issuecomment-1303892113

   If have changed it to where the effective POMs are written to standard out 
when the output flag is not set. 
   
   When the output flag is set, we need to interpret that as relative to the 
build directory of the (sub)project. A problem is actually that output flag 
will be parsed as a file, and thus contains the full absolute path (including 
the drive on Windows). Luckily, the project where we run the command from is 
available and provides a basedir. 
   
   I have used this to do some testing:
   
![image](https://user-images.githubusercontent.com/17497376/200032538-57251fc4-0bc9-4885-bd99-7a1e8d228cd9.png)
   You can see the full path on top (triplem).
   
   If you run the following command from the main module:
   
   ```
   mvn clean help:effective-pom -Dindividual 
-Doutput="effective/effective.pom.xml"
   ```
   
   |Parameter|Value|
   | --- | --- |
   | `basedir` | `C:\Users\TomS\TempProjects\triplem` |
   | `output` | 
`C:\Users\TomS\TempProjects\triplem\effective\effective.pom.xml` |
   
   To then get the relative output I made it to remove the basedir from the 
output path, meaning you are left with `effective\effective.pom.xml`.
   
   ```
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\target\effective\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\drinks\cola\target\effective\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\drinks\fanta\target\effective\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\drinks\target\effective\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\chocolate\bounty\target\effective\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\chocolate\mars\target\effective\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\chocolate\target\effective\effective.pom.xml
   ```
   
   Now run the following command from the main module:
   
   ```
   mvn clean help:effective-pom -Dindividual -Doutput="../effective.pom.xml"
   ```
   
   |Parameter|Value|
   | --- | --- |
   | `basedir` | `C:\Users\TomS\TempProjects\triplem` |
   | `output` | `C:\Users\TomS\TempProjects\effective.pom.xml` |
   
   Now the `output` does not actually contain the `basedir`. In that case I 
have currently implemented it to just look at the name of the output path, 
which now is `effective.pom.xml` and use that as a file name in the build 
directory. 
   
   ```
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\target\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\drinks\cola\target\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\drinks\fanta\target\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\drinks\target\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\chocolate\bounty\target\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\chocolate\mars\target\effective.pom.xml
   [INFO] Effective POM written to: 
C:\Users\TomS\TempProjects\triplem\chocolate\target\effective.pom.xml
   ```
   
   As a conclusion, you are now able to specify a relative path, but there is a 
constraint on relative paths going up the file tree. Please let me know if you 
see another solution?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to