Java Build Engine environment variables
Hello...
(I can't get a less than or greater than sign to show up in my code samples, so know that ~ means less than and /~ is /greaterthan)
We are attempting to set up a build for our Visual Studio project. The build engine service described below is running on a Windows XP machine.
We have a build engine service running with the following command:
C:\Builds\v12\JavaServiceLauncher\bin\jsl.exe
The service is running under a domain user account. If we log into the XP machine, and start a command prompt, the PATH environment variable contains about a dozen paths, including c:\windows\system32 as expected.
We call msbuild.exe project.msproj. One of the targets calls an exec task:
The resulting log says that "'xcopy' is not recognized as an internal or external command, operable program or batch file."
If we use
the build successfully completes.
We changed the command of our build definition to simply execute cmd /c PATH. The results of that build showed that, at the time of execution of the command, the path environment variable is:
PATH=C:\JAVA\TEST
How do we get the PATH environment variable to retain its value under the context of jsl.exe?
(I can't get a less than or greater than sign to show up in my code samples, so know that ~ means less than and /~ is /greaterthan)
We are attempting to set up a build for our Visual Studio project. The build engine service described below is running on a Windows XP machine.
We have a build engine service running with the following command:
C:\Builds\v12\JavaServiceLauncher\bin\jsl.exe
The service is running under a domain user account. If we log into the XP machine, and start a command prompt, the PATH environment variable contains about a dozen paths, including c:\windows\system32 as expected.
We call msbuild.exe project.msproj. One of the targets calls an exec task:
~exec command="xcopy "pathtofile" "pathtodest" /E /Y" /~
The resulting log says that "'xcopy' is not recognized as an internal or external command, operable program or batch file."
If we use
~exec command="c:\windows\system32\xcopy "pathtofile" "pathtodest" /E /Y" /~
the build successfully completes.
We changed the command of our build definition to simply execute cmd /c PATH. The results of that build showed that, at the time of execution of the command, the path environment variable is:
PATH=C:\JAVA\TEST
How do we get the PATH environment variable to retain its value under the context of jsl.exe?
3 answers
The problem is that a program launched as a Windows service does not run under the normal shell, and so it does not have the usual path set.
The release notes for the latest version of Java Service Launcher state:
(via http://jslwin.sourceforge.net/changelog.html)
So you could try setting the PATH in the .ini file. If that doesn't work, you could configure the build to run a batch script that sets up the path, then invokes the Ant script.
Regards,
Nick Edgar
RTC Build component lead
The release notes for the latest version of Java Service Launcher state:
Release 0.99j (January 2009) Variables defined in the .ini files section can now be exported to the environment. The new "export" parameters in the section contains a comma separated list if variables to be exported (e.g. export = PATH,CLASSPATH ). The "wrkdir" parameters treats paths starting with a "." special. As a service has no shell from which to inherit a default working directory a "." was not a valid path so far. From this version the "." in the wrkdir (and only there as all other paths will be relative to the wrkdir) will be substituted by the directory in which the .ini file resides.
(via http://jslwin.sourceforge.net/changelog.html)
So you could try setting the PATH in the .ini file. If that doesn't work, you could configure the build to run a batch script that sets up the path, then invokes the Ant script.
Regards,
Nick Edgar
RTC Build component lead