Hudson -- Windows execute windows batch command - windows

I currently running the following commands on a hudson slave deployed on a windows machine.
dir
cmd
mvn clean install
I get the following return on the build.
mvn' is not recognized as an internal or external command,
operable program or batch file.
I have set the correct path on the node which points to the hudson installation on the windows machine.
I have also set the correct Path for JAVA and M2_HOME on the windows slave machine.
I was hoping for the correct way to call maven and maybe another *.bat file if need be in the future.
Please and thank you

I still haven't figured this out. A good work around is to use the full path to mvn to run it. Which worked for me.

Related

'mvn' command is not recognized as an internal or external command, was working

Yesterday, I went through a tutorial that had me set up maven, and I got the project working, and shutdown the windows pc.
Now today, the mvn command isn't working.
C:\>mvn -version
'mvn' is not recognized as an internal or external command,
operable program or batch file.
My system variable:
MAVEN_HOME=C:\opt\apache-maven-3.6.3
My path variable includes this at the end:
;%MAVEN_HOME%\bin
It looks like my system variable is set up correctly:
Make sure that when you're seetting up your M2_HOME that it's pointing to you Maven basedir, NOT the bin dir.
Afterwards, make sure to set the path and PATH something like so: (PATH=%M2_HOME%\bin;%PATH%).
Then restart your machine and run this command.
dir %M2_HOME%\bin\mvn*
If there is a .bat file, it should work since you seem to run Windows. If there isn't one, then your paths are not right and you need to make sure your %PATH% variable points to the correct path to Maven.
Not sure why, but its working as it should today, no changes were made other than a restart of the windows PC. Will continue to monitor, but I can't replicate the problem to investigate it anymore.

IntelliJ terminal setup

I used to run gradle test via IntelliJ terminal with following command,
>gradle test Accidentally I deleted my windows path environmental variable in my windows 7 machine.
After this when I run above command I get below error
'gradle' is not recognized as an internal or external command,
operable program or batch file.
What should I add in path environmental variable to get this run again
IntelliJ version 13.0.3
I added all java and gradle path under env. variable (I can run test via cygwin with above command)
Thanks
This issue was resolved after restarting the windows. Because after adding path to the env variable and restart IntelliJ was not enough.
I should have done this before posting the question.
Please bear with me if any convenience caused.
Cheers

Msbuild works via VS and command-line, but fails via Jenkins

I am trying to build a VS .sln that has multiple C++ .vcproj's in it. The solution file is generated using CMake and I've got this part working in Jenkins (with the CMake builder plugin). To build the solution file, I am using msbuild. I am able to build the solution using both Visual Studio and from the command line with the following command:
C:\Jenkins\workspace\SonioTest>"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /t:Rebuild bin/SonIO.sln
This builds successfully (on the same machine that Jenkins resides).
However, I am trying to automate this portion of the build in Jenkins and the build ends up failing with a couple of C1083 errors ("Cannot open source file: '..\path\to\file.ext': No such file or directory). I have tried using both the Jenkins msbuild plugin and using the exact same command that works in the terminal as a "Execute Windows batch command" build step, with the same result.
When using the Windows batch command build step, I can see in the log that the command being executed:
C:\Jenkins\workspace\SonioTest>"C:\Windows\Microsoft.NET\Framework\v4.0.30319 msbuild.exe" /t:Rebuild bin/SonIO.sln
... is exactly the same as the one that works from the command line, including the working directory.
I am running Jenkins as a service and I have the service logon as my account (with administrator privileges). Anyone know what directory Jenkins will execute batch commands out of?
Any ideas why I'm seeing this difference of behavior between Jenkins and the command line?
This is as much a workaround as a solution, but I ended up using devenv instead of msbuild and it works fine.
I know that this hints strongly as it being an environmental issue, but since it's not a problem to have VS installed on the build server, I decided to save the time that would be spent in the msbuild rabbit hole.
The environment being used by the account that the Jenkins slave agent is not the same environment as you use when doing the same command line from a prompt. Compare the two environments, note the difference, then add them to the Jenkins job.
To get the environment of the slave while running, have it do a "set" from a Windows Command Prompt
Without knowing much about VS build, it looks mostly like an environment setup.
My first advice would be to make sure, in Jenkins, you change directory to the same directory you ran the good command from and try it then.
Also, might want to try running Jenkins as a standalone app first.
And as a service, maybe allow service to "interact with desktop".
I may be late to the party, but I still ran into this problem on a new Jenkins setup on Server 2016.
My solution was to use the MSBUILD straight from the VS2017 installation C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin. No more errors.

jenkins: windows xp, windows 7 slave cannot execute commands

I have a Arch Linux master that drive 2 arch linux slaves, 1 windows xp slave and 1 windows 7 slave. Linux part is all ok, I managed in some way to start windows slave using automatic execution and slave.jar. I have an external program that need to be executed and it's installed on c:\program files (x86) on windows7 and on c:\programs on windows xp.
I went on path variables and inserted the two path on the two systems, but when I try to run jenkins build it says "command not found"
I tryed to place 2 bat files in c:\ poining to the right place, based on every system, but it says c:\build.bat command not found. I can see the file in the right place...
How do you manage executables placed in different places on different computers?
there's a better way to run the program?
I can change everything about this installation, the only thing I need it to find a way for starting that program.
thank you for your help.
Have you verified that the changes you made to the system path were actually saved? Make sure both of the slaves have been rebooted and then test this via a standard command line window.
If the program you're trying to execute is actually on the path, you could also look at the Envfile Plugin.
After adding new paths to your environment variable PATH you need to restart jenkins slave service in order to allow it to use these new PATHs.
I solved the problem changing the way jenkins start the job on the slave. I used "Execute shell" and some program are executed. I changed "Execute shell" with "Execute windows batch command" and everything works fine.

Cannot use jar command on windows

The jar command is not working on my box. I have downloaded the jdk, and set the envar "Path" to include the path to the jdk \bin directory. However, I still get that annoying message, "'jar' is not recognized as an internal or external command, operable program or batch file." Does anyone have any suggestions to solve this problem?
I think from the error message that you're using Windows?
If so, did you try it in a command prompt that you opened after changing your path using the GUI? And did you double check for typos in the path you added?
You can always try running "echo %PATH%" to check your path, and ensure your change is both showing up and error free
Can you paste the result of env command ? Or please launch new command prompt, then please try again if you think you configuration is Ok.

Resources