Last active
February 7, 2020 10:52
-
-
Save fmarot/3bc638212e52ff1e0c55843c7fb6bbaa to your computer and use it in GitHub Desktop.
surefire 3.0.0-M4 problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.teamtter.fake</groupId> | |
<artifactId>test-fake-module</artifactId> | |
<version>2.0.0-SNAPSHOT</version> | |
<properties> | |
<java.source.target.version>1.8</java.source.target.version> | |
<surefire.version>3.0.0-M3</surefire.version> | |
</properties> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>ru.yaal.maven</groupId> | |
<artifactId>write-text-files-maven-plugin</artifactId> | |
<version>1.1</version> | |
<configuration> | |
<charset>UTF-8</charset> | |
<files> | |
<file> | |
<path>src/test/java/com/teamtter/AppTest.java</path> | |
<lines> | |
<line>package com.teamtter; </line> | |
<line>import org.junit.Assert; </line> | |
<line>import org.junit.Test; </line> | |
<line>public class AppTest { </line> | |
<line> @Test </line> | |
<line> public void toto() { </line> | |
<line> String envPath = System.getenv("PATH");</line> | |
<line> System.out.println("envPath = " + envPath);</line> | |
<line> String envLDPath = System.getenv("LD_LIBRARY_PATH");</line> | |
<line> System.out.println("envLDPath = " + envLDPath); </line> | |
<line> Assert.assertTrue(envPath.contains("TEST")); </line> | |
<line> }</line> | |
<line>}</line> | |
</lines> | |
</file> | |
</files> | |
</configuration> | |
<executions> | |
<execution> | |
<id>write-text-files</id> | |
<phase>validate</phase> | |
<goals> | |
<goal>write-text-files</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<artifactId>maven-surefire-plugin</artifactId> | |
<version>${surefire.version}</version> | |
<!-- <version>3.0.0-M4</version> --> | |
<!-- <version>3.0.0-M3</version> --> | |
<!-- <version>2.22.0</version> --> | |
<configuration> | |
<environmentVariables> | |
<LD_LIBRARY_PATH>MY_REDEFINED_LD_PATH</LD_LIBRARY_PATH> | |
<PATH>TEST;${PATH}</PATH> | |
</environmentVariables> | |
<!-- <argLine>@{argLine} -Dfile.encoding=UTF-8</argLine> --> | |
<argLine>-Dfile.encoding=UTF-8</argLine> | |
<includes> | |
<include>**/*.java</include> | |
</includes> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.11</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This pom.xml demonstrates that surefire 3.0.0-M4 has a problem: it does not redefines environment variable if they are already defined. PATH is always defined and shows the problem. It works with 3.0.0-M3
This command first succeeds but then fails with 3.0.0-M4:
mvn test -Dsurefire.version=3.0.0-M3 && mvn test -Dsurefire.version=3.0.0-M4