I have set up OpenSSH in my windows environment and wants to invoke a ANT script from a Linux environment. But i'm getting the following error:
$ ant -f invoke.xml
Buildfile: /home/inysi/jpegu/cdt/tmp/invoke.xml
run:
[sshexec] Connecting to ******
[sshexec] cmd : ant -f build.xml
[sshexec] uname: not found
[sshexec] basename: not found
[sshexec] dirname: not found
[sshexec] Error: JAVA_HOME is not defined correctly.
[sshexec] We cannot execute java
[sshexec] which: not found
BUILD SUCCESSFUL
Total time: 2 seconds
But, i can invoke the remote ANT script in Linux environment using SSHEXEC from windows.
Can you please let me know, what could be the issue. JAVA_HOME is set in the windows environment variables. Where to set JAVA_HOME in the windows environment. Is there something similar to .bash_profile in windows. So that ANT process can pick it up.
Looks like you are connecting to the user account that does not have its environment setup correctly, because it cannot find any standard commands.
Providing us with a better sample of invoke.xml may help.
The invoke.xml file:
sshexec host="windows.host" username="Test" password="test123" trust="true" command="ant -f build.xml
I have created the user "Test" in the windows host. I can invoke other commands e.g "java -version or java classname". But its only when i try to run an ANT script in the windows, it gives error "JAVA_HOME not defined".
It looks like the shell created at the SSH server side to invoke the command is not able to access the user environment variable "JAVA_HOME".
Related
I am trying to execute the command "sqlplus -S ${db_user}/${db_password}#${db_host}:1521/${db_sid} #${WORKSPACE}/${FIX_VERSION}/${sql_file}" in a Jenkins build and I keep getting the error "sqlplus: command not found." I have a mac and downloaded sqlplus through homebrew. I'm not sure what I am missing (if it is potentially environment variables), or how to solve the problem
Try updating the PATH variable to include sqlplus executable location before executing your SQL plus command.
sh """
PATH=<SQL_PLUS_HOME>/bin:$PATH
sqlplus -version
"""
i installed jenkins in c:\program files(x86)\jenkins and am trying to integrate with a helloworld java file. but when i first tried to build from jenkins, itself, its failed.
i went through this link : https://www.youtube.com/watch?v=bGqS0f4Utn4
when i compiled my java file, from the admin cmd prompt, its compiles successfully. but it failed within the jenkins console.
I created a C:\workspace folder and saved the java file, there.
what am doing wrong ? why am getting the wrong path within the console output?
am getting the below error in the console output :
`Console Output
Started by user user1
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\
HelloWorld
[HelloWorld] $ cmd /c call C:\Windows\TEMP\jenkins6223662388306682118.bat
C:\Program Files (x86)\Jenkins\workspace\HelloWorld>cd C:\Workspace
C:\Workspace>javac Hello.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>java Hello
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
First, since you've installed JDK, make sure you've added in system level environment variable
Set JDK bin path in Jenkins > manage jenkins > global tools configurations > jdk installations, then try
mostly this option would help to resolve
I am trying to compile jnativehook by following this tutorial. I followed all the steps (I am running on windows and have used Cygwin in some parts) until the Building section (running ant all command). I have added environment variables as follows:
ANT_HOME -> C:\Program Files\Apache\apache-ant-1.10.5
JAVA_HOME -> C:\Program Files\Java\jdk1.8.0_131
And added the following to path:
C:\Program Files\Apache\apache-ant-1.10.5\bin
C:\Program Files\Java\jdk1.8.0_131\bin
However, whenever I try to run the ant all command (with the default command prompt and as an administrator) I get this error:
The syntax of the command is incorrect.
I got the same error when trying to run the batch file from the command prompt:
cd C:\Program Files\Apache\apache-ant-1.10.5\bin
ant.bat
The syntax of the command is incorrect.
ps: when I run java -version command it returns:
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
I'm trying to install jenkins on windows and I have Cygwin.
I provided the bash.exe path to jenkins and add a job which executes a .sh file.
The output is like:
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Build_Release
[Build_Release] $ C:\cygwin64\bin\bash.exe -xe C:\WINDOWS\TEMP\jenkins8276366787192439492.sh
+ cd /cygdrive/d/01-Avelabs/001-Projects/001-VGTT/001-Repos/P2.4.0.5/host/AdasHost/Application/
+ ./BuildHost.sh
./BuildHost.sh: line 2: make: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
What am I missing?
To get you going (the problem is not obvious but it should be easy enough to debug): Add a "set" command at the top of the script to dump the environment variables, including the PATH. You will very likely find that PATH is not in any of the folders listed in the value of the PATH env var. (You could also put simply, "echo $PATH".)
Some possibilities:
When I start bash in Windows I typically inherit the Windows path, but not the Linux path: /cygdrive/c/windows/system32 is included, but /bin is not. So, even basic Linux commands like "ls" result in "command not found" errors. I'll typically start a bash session with "export PATH=/bin:$PATH" to get around this.
Even if you initialize the path with a .bash_profile script, the user under which Jenkins is executing is probably not executing the same initialization script.
Finally - and not meaning to say "Is it plugged in? - but: I ran a clean Cygwin install and did not get make by default. So be sure it is included in /your/ installation!
Installed:
Sonarqube 5.5
Sonar-runner 2.4 (http://dev.mamikon.net/installing-sonarqube-runner-on-ubuntu/)
When I try to run Jenkins with a simple project, this is the error I get:
[test] $ sonar-runner -e
-Dsonar.host.url=http://server_url:9000/sonar/ -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/test
SONAR ANALYSIS FAILED
FATAL: command execution failed. java.io.IOException: Cannot run
program "sonar-runner" (in directory
"/var/lib/jenkins/workspace/test"): error=2, No such file or directory
It seems that jenkins cannot find the sonar-runner program.
But when I open the server with a terminal, and run sonar-runner, it analyzes the project.
Can someone help me with this?
after hours of frustration, it turned out i had to add environment variable in the /etc/profile file.
export SONAR_RUNNER_HOME=/opt/sonar-runner
export PATH=$PATH:$SONAR_RUNNER_HOME/bin