Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Cannot change environment variable TEMP in Maven step #4371

Laba42 ·

I have the problem that I can not change the TEMP environment variable. As an example a simple Maven project

MavenHelpSystem.png

generates the following log output (I left out the irrelevant output now)
The WARN entries, are output from me to control which build parameters and environment variables I have passed.

15:20:16,122 INFO  - Executing pre-execute action...
15:20:16,123 INFO  - Running step...
15:20:16,133 INFO  - Checking step execute condition...
15:20:16,134 INFO  - Step execute condition satisfied, executing...
15:20:16,271 INFO  - Executing pre-execute action...
15:20:16,330 WARN  - Passing Buildproperties des Steps => Build-Maven-Help-Test
15:20:16,330 WARN  - ###############################################################
15:20:16,337 WARN  - java.io.tmpdir = D:\Temp\HelloWorld\
15:20:16,338 WARN  - ###############################################################
15:20:16,338 WARN  - Passing  Environmentsproperties des Steps => Build-Maven-Help-Test
15:20:16,338 WARN  - ###############################################################
15:20:16,338 WARN  - MAVEN_OPTS = -Xmx4096m
15:20:16,338 WARN  - Temp = D:\Temp\HelloWorld\
15:20:16,338 WARN  - Tmp = D:\Temp\HelloWorld\
15:20:16,338 WARN  - java.io.tmpdir = D:\Temp\HelloWorld\
15:20:16,338 WARN  - ###############################################################
15:20:16,338 INFO  - Running step...
15:20:17,565 INFO  - Scanning for projects...

15:20:18,762 INFO  - Building HelloWorld 1.0-SNAPSHOT
15:20:18,769 INFO  - --- maven-help-plugin:3.2.0:system (default-cli) @ HelloWorld ---

15:20:22,036 INFO  - ===============================================================================
15:20:22,036 INFO  - System Properties
15:20:22,036 INFO  - ===============================================================================

15:20:22,036 INFO  - os.name=Windows Server 2019
15:20:22,036 INFO  - sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -Djava.io.tmpdir=D:\Temp\HelloWorld\ help:system
15:20:22,036 INFO  - java.home=D:\Apps\Java\OpenJDK11
15:20:22,036 INFO  - ===============================================================================
15:20:22,036 INFO  - Environment Variables
15:20:22,036 INFO  - ===============================================================================
15:20:22,036 INFO  - MAVEN_CMD_LINE_ARGS=-Djava.io.tmpdir=D:\Temp\HelloWorld\ help:system
15:20:22,036 INFO  - TEMP=C:\Users\bmeise\AppData\Local\Temp
15:20:22,036 INFO  - TMP=D:\Temp\HelloWorld\
15:20:22,036 INFO  - JAVA.IO.TMPDIR=D:\Temp\HelloWorld\
15:20:22,036 INFO  - ------------------------------------------------------------------------
15:20:22,036 INFO  - BUILD SUCCESS

Can or should the TEMP environment variable not be changed?

Georg

  • solved #5
  • replies 4
  • views 188
  • stars 0
robinshen ADMIN ·

From the log output, the new temp directory is being passed correctly. Maybe Maven is not honoring this setting. Can you please run maven directly from command line by specifying -Djava.io.tmpDir="D:\Temp\HelloWorld" to see if it works?

Laba42 ·

Yes, it works, but it doesn't help me because some parts of our application access the TEMP environment variable.

But it is strange that you can set or change all environment variables but not the TEMP variable.

We are now trying to change this in our application.

Georg

robinshen ADMIN ·

As long as you can print the environment variables correctly, QB should have done its job as expected... I am not sure why it is not taking effect in your application. If you can create an example able to run at my side demonstrating the issue, I might be able to dig further...

Laba42 ·

It's ok, if I write TEMP in upper case then the environment variable is also set correctly. It's quite strange that on a Windows system upper lower case is taken notice.

Thanks