HannesWell commented on code in PR #148:
URL: 
https://github.com/apache/maven-toolchains-plugin/pull/148#discussion_r3210753283


##########
pom.xml:
##########
@@ -146,4 +146,34 @@ under the License.
       </plugin>
     </plugins>
   </build>
+  <profiles>
+    <profile>
+      <id>run-its</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <version>3.6.1</version>
+            <executions>
+              <execution>
+                <id>sanitize-java-home</id>
+                <goals>
+                  <goal>regex-property</goal>
+                </goals>
+                <!-- Prevent it-test failures on Windows due to interpretation 
of back-slashes in paths.-->

Review Comment:
   Yes. I looked into it in detail and it turned out I was on a wrong track 
(don't recall anymore why I assumed it's a Windows path issue).
   
   In fact the problem seems that the invoker-plugin does not interpolate 
access to env variables and only considers only a limited set of properties 
(e.g. not `java.home`).
   But it does consider properties defined in a pom (or CLI), so just defining 
the property `<JAVA_HOME>${env.JAVA_HOME}</JAVA_HOME>` solved it for me locally 
and the integration tests succeeded.
   Alternatively 
   - one could define properties with 
[`filterProperties`](https://maven.apache.org/plugins/maven-invoker-plugin/run-mojo.html#filterProperties)
   - define the environment variables using 
[`environmentVariables`](https://maven.apache.org/plugins/maven-invoker-plugin/run-mojo.html#environmentVariables)
   
   but just adding one property seems the simplest solution for me.
   
   @slawekjaranowski I hope that the CLI succeeds now.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to