Does upgrading Jenkins.war file cause Environment variables to not be populated? - jenkins

I upgraded to the latest version of the jenkins.war file. The jobs run but when it sends and email the environment variables are not populated. Some of the variables I use are
[$BUILD_STATUS] - $PROJECT_NAME - $BUILD_NUMBER $BUILD_ID
Is there a know issue with this ?

Related

Jenkins Sonarqube Plugin: JAVA_HOME exists but does not point to a valid Java home

I am trying to set up the Sonarqube for my project, but when I start to generate a build, I get the following error:
ERROR: JAVA_HOME exists but does not point to a valid Java home
folder. No "\bin\java.exe" file can be found there.
The SonarQube Scanner did not complete successfully
I check some docs but none of them helps. For the JAVA_HOME environment variable, I point it to be C:\Program Files (x86)\Java\jdk1.8.0_111 I also double check it by using powershell java -version command. It also gives me the same answer: java version "1.8.0_111" . Anyone knows how to solve the problem?
Thanks.
You can edit:
C:\Users\HOME_FOLDER\.jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarQubeScanner\bin>notepad sonar-scanner.bat
and put following:
SET JAVA_HOME=< JDK Path>
if EXIST in the sonar-scanner.bat fails because there is a space in the path, so the solution is to set the JAVA_HOME to a value without spaces e.g. using the short name of the "Program Files" SET JAVA_HOME= C:\Progra~1\Java\jre9
I encountered the same error. The issue was with sonar-scanner.bat referencing wrong %JAVA_HOME% path.
In the sonar-scanner.bat the variable "use_embedded_jre" is set to true and immediately the validation is done for the PATH.
#REM ==== START VALIDATION ====
#REM *** JAVA EXEC VALIDATION ***
set use_embedded_jre=true
if "%use_embedded_jre%" == "true" (
set "JAVA_HOME=%SONAR_SCANNER_HOME%\jre"
)
Set the variable value to "false", the issue will be fixed.
set use_embedded_jre=false
Ensure that JAVA_HOME is pointing JDK .
Please try to reinstall the java 8. Setup JAVA_HOME again then It will work.
This problem might be because space between "Program Files (x86)"
I had the same problem and struggled with it for a while.
After modifying sonar-scanner.bat a bit I found out that during execution of Sonarqube the %JAVA_HOME% was completely different from the one I configured in my environment variables.
Turned out I had hardcoded JDK installations in my Global Tool Configuration inside Jenkins.
My solution:
Open your Jenkins, go to Manage Jenkins -> Global Tool Configuration
Click JDK installations...
Make sure JAVA_HOME parameter is empty or just click Delete JDK
In this case Jenkins will use %JAVA_HOME% variable it finds during the execution and it's just the one you configured in your environment variables. Worked for me
You should restart your machine after java installation.
I was having the same issue. On my machine JRE was located at C:\Program Files (x86)\Jenkins\jre. So I appended System's PATH Environment Variable with C:\Program Files (x86)\Jenkins\jre\bin;
It worked.
Do not forget to restart Jenkins service from Windows Services

Jenkins not loading with correct config.xml file

I am having a strange issue with my Jenkins (1.646) were by when I run;
Java -jar %~dp0jenkins.war% --httpPort=XXXX from the command line Jenkins runs and it seems to create a whole new instance under my user folder and doesn't read any files located under C:\.jenkins and importantly completely misses the;
config.xml file (located .jenkins)
Thankful for any help/pointers
I have managed to fix this issue by setting the environment variable JENKINS_HOME to c:\.jenkins.
When I then run the java -jar %~dp0jenkins.war%.... batch file it now correctly picks up the config.xml

SONAR in Jenkins - "can't find \bin\java.exe" (2015)

For some reason Sonar can't find the java.exe.
Don't have in my JAVA_HOME semicolon...
ERROR: JAVA_HOME exists but does not point to a valid Java home
folder. No "\bin\java.exe" file can be found there.
env variable:
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71
of course I have under this folder the "\bin\java.exe"...
When I take the command line from Jenkins console and run it in CMD it seems to work (have failures within sonar logic around my project which is ok)
At the job configuration level do you have the option of multiple JDK's? If it's set to default, change it to JDK7

How to set Jenkins installation file location?

I want to set Jenkins file location to E:\Programs\Jenkins kind of location
I'm using the command java -jar jenkins.war
How do i specify the file location with that commad
I think you mean jenkins home. Just specify JENKINS_HOME environment variable before launching jenkins. If you are using Windows go to user accounts configuration and change your environment variables. Add variable JENKINS_HOME with value E:\Programs\Jenkins.

setting environment variables

I'm setting up grails, and these are the commands the README indicates you should run for a unix machine. My problem is that the echo command doesn't output anything like it should. I double checked and have the grails folder in the right directory.
> set GRAILS_HOME=~/grails
> export GRAILS_HOME
> echo ${GRAILS_HOME}
~/grails
you need to set the path variable:
export GRAILS_HOME=/path/to/grails
export PATH=$PATH:$GRAILS_HOME/bin
For OS X Lion you add these lines this is to your ~/.bash_profile file. This is the same as your /Users/macUsername/.bash_profile. After saving this edit, new terminal windows will have this effect in place. You can also run source ~/.bash_profile to make the change happen in your current terminal window.
On another *nix you would edit a slightly different file.
The .bash_profile file holds commands that run every time you start your terminal.
Installation from Download
Prerequisites
Before you can start using Grails you will need to install a Java SDK (not just a JRE) and set the JAVA_HOME environment variable to the location of that SDK. The minimum required version of the SDK depends on which version of Grails you are using:
Java SDK 1.4+ for Grails 1.0.x and 1.1.x
Java SDK 1.5+ for Grails 1.2 or greater
Steps
Download the latest Grails release
Extract the archive into an appropriate location; typically C:\grails on Windows or ~/grails on Unix
Create a GRAILS_HOME environment variable that points to the path where you extracted the archive (eg C:\grails on Windows or ~/grails on Unix)
If you have not set the JAVA_HOME environment variable yet, create JAVA_HOME environment variable that points to the path where you have installed Java
Append a reference to the "bin" directory within the Grails directory to your PATH variable (eg %GRAILS_HOME%\bin on Windows or $GRAILS_HOME/bin on Unix). Note that, for Windows, both PATH and GRAILS_HOME must be defined at the same environment variable level (eg. 'System variables') rather than across environment variable levels (eg. PATH under 'System variables' and GRAILS_HOME under 'User variables')
Type "grails" at the command line, if a help message is displayed you are ready to start using Grails!
If you get an error message, try to chmod +x the grails script inside the bin directory.
Installation from Git (The Version Control Repository)
Prerequisites
In order to start using Grails from Git you need to have the following:
An installation of Java 1.5 or higher and have set your JAVA_HOME variable to the install location
A Git client
Steps
Check out Grails from the Git repository
by running: git clone git://github.com/grails/grails-core.git
Set the GRAILS_HOME environment variable to CHECKOUT_LOCATION/grails-core
Add the $GRAILS_HOME/bin directory to your PATH environment variable
What happens next depends on which branch you are working on.
For the 2.0.x and the 'master' branch:
Go to the GRAILS_HOME directory and run: ./gradlew install
That's it! You can now start developing in Grails using your custom copy of Grails!
For the 1.3.x branch:
Go to the GRAILS_HOME directory and run: ./gradlew libs
Then from the GRAILS_HOME directory run: ./gradlew install
That's it! You can now start developing in Grails using your custom copy of Grails!
For the 1.2.x branch:
If you don't have Ant 1.7 (or later) installed, you will need to
set ANT_HOME to $GRAILS_HOME/ant
add $ANT_HOME/bin to your PATH environment variable
you may need to give the scripts in $ANT_HOME/bin execute permissions
Increase the java memory to 1024M by setting ANT_OPTS=-Xmx1024M
Go to the GRAILS_HOME directory and type ant jar to build Grails
That's it! You can now start developing in Grails using your custom copy of Grails!
Confirm your grails install by grails -version

Resources