XDG_RUNTIME_DIR not set in the environment Jenkins - maven

I have an automation script that needs to be executed through Jenkins. For this I need to open Firefox browser. For this I made some R&D and installed certain plugins in Jenkins like, ChromeDriver, XVFB and XVNC plugins.
I've added the "Xvfb installation" details in Jenkins global tool configuration and configured my Project with enabling the "Start Xvfb before the build, and shut it down after." option in Build Environment.
After these setup I executed the build, but when executed, this error showed up
error: XDG_RUNTIME_DIR not set in the environment.
Error: cannot open display: :0
So for fixing the above, I made some R&D and came across this
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit
When I enter the above code in Terminal, it just opens a new document in gedit.
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit
Now I'm stuck where to set the above variables. In which file should I update this?
If I fix this issue will the Jenkins build will be successful?
The project I have is a maven project, which when executed through eclipse, works fine by opening the browser. But through Jenkins it is failing.
Any help is greatly appreciated. Please help. Thanks in advance.

Related

IntelliJ IDE - cannot run Maven from terminal inside IDE (path is set)

last week I got new laptop from company so I had to do new installation from scratch.
I installed my JDK, Maven, git bash and IDE, configured environment variables for MAVEN_HOME and JAVA_HOME... added them to Path with for example: %JAVA_HOME%\bin and same for maven.
Both JDK and Maven work perfectly fine with cmd and git bash or even with maven plugin in IntelliJ.
But if i want to open terminal inside of IDE and run some maven command it will give me mvn not found error.
I use /wanna use git bash, but it gives same error for cmd inside of IDE as well.
I've checked terminal system environemtns setting in IDE and I can find MAVEN_HOME inside and I even tried to add M2_HOME but error is the same (I do reset terminal after every change).
Also, in git bash if I write echo $PATH it will return me my variables as it can be seen here:
/mingw64/bin:/usr/bin:/c/Users/user.name/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:
/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:%JAVA_H
OME%/bin:%MAVEN_HOME%/bin:/cmd:/c/Users/prese/AppData/Local/Microsoft/WindowsApps:/c/Users/username/AppData/Local/Programs/Microsoft VS Code/bin:/c/Program Files/herok
u/bin
I never had an issue like this as usually all I had to do after installig java/maven and git bash was to change default terminal in IDE to git bash.... and that's it.
But something is different this time around.
Please do share what can I do and/or try.
EDIT:
If I write:
export PATH=$PATH:/c/Program\ Files/Apache\ Maven/apache-maven-3.6.3/bin
This will set maven and it will work... but only for this instance of terminal... new instace and session will not have it

Gradle miss environment variable when running tasks from IntelliJ IDA in WSL

I'm working on a Gradle project with multiple sub modules. Some of these are using maven. Thus one Gradle task is running maven from the MAVEN_HOME directory. This task is called by IntelliJ IDEA during Gradle refresh. When running IntelliJ Community Edition 2021.1 on an Ubuntu 20_05 VM, everything works fine. When running the same version of IntelliJ Windows with WSL 2, the task fails with error
MAVEN_HOME environment variable not set, unable to locate mvn executable for build
When I open a shell in WSL, I see that the MAVEN_HOME is actually set. I've defined it in my ~/.profile file. I can build my project from the terminal command line. IntelliJ IDEA uses the Gradle wrapper for building the project. It uses the shebang #!/bin/env sh. So it is not opening a login shell und thus the ~/.profile files are not read.
Any ideas how to solve this problem?

Run foreman inside of intellij

I'm able to run Heroku foreman no problem from my windows command line but I'm having trouble figuring out how to run it inside of IntelliJ. I attempted to enable the "Batch Support" plugin but it crashes when I start up IntelliJ. I also tried to run it through the "Command Line Tools" plugin but that couldn't find foreman.
How can I successfully run Heroku foreman inside of IntelliJ?
Figured it out...created an external tool at Settings -> External Tools (see below). Can then run by selecting Tools -> foreman

How do I get Netbeans 7.3.1 to see my environment variables on Mac OS X (10.8.3)?

I'd like to run Netbeans from the launcher and get it to see environment variables.
Background:
I'm using netbeans for a rails project and have configured my devel database with configurations using environment variables.
Unfortunately Netbeans appears unable to read those variables even when I list them in /etc/profile (for all users).
I can explicitly run Netbeans from the terminal: /Applications/NetBeans/NetBeans\ 7.3.1.app/Contents/MacOS/netbeans and that gets things to work but I'd much rather run it from
the launcher if I can solve this problem.
You could define them in
/etc/launchd.conf
and restart system. See this for example
If you run NetBeans from the command line, e.g.
open
/Applications/NetBeans/NetBeans 8.1.app/Contents/Resources/NetBeans/bin/netbeans
then the environment variables defined in the shell initialization script will be visible in the NetBeans application. If you start NetBeans via the icon, the initialization scripts are not run.

Mac 10.6 server / tomcat / jenkins / vncserver can not run in directory

First let me point out I'm a newbie with tomcat & Jenkins. This is the first CI server i have setup.
Im developing a flex app, and my goal is to have jenkins auto-build and run flexUnit tests after changes are pushed to github.
so far I have:
installed Jenkins (1.450) under tomcat (6.0.33) on a headless mac mini server running (10.6.8)
(basically following "Servlet Container Installation on Mac OS X Server (10.6)" #
http://wiki.wocommunity.org/display/WO/Installing+and+Configuring+Jenkins+Build+Server)
downloaded flexSDK, setup user authentication and configured github hooks.
at this point everything is working fine, jenkins will build a simple flex app once changes are pushed to github
now I'm attempting to build the flexUnit Sample CI Project. on first attempt it gets stuck waiting for a replay from Flash Player Debugger (projector). After some research I found flash player needs to run in a virtual display. So I installed Xvnc Jenkins/Hudson Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin).
Os X has a built in vnc server however it doesn't seem to communicate with Xvnc, so I installed tightvnc (via macports).
Then I setup the VNC password in my jobs workspace by running the following command in terminal
"sudo -u _appserver vncpasswd /Library/Jenkins/jobs/flexUnitSampleCIProject/workspace/.vnc/passwd"
And this is where I'm stuck, when I try to build flexUnitSampleCIProject I get the following error
FATAL: Cannot run program "vncserver" (in directory "/Library/Jenkins/jobs/flexUnitSampleCIProject/workspace"): error=2, No such file or directory
java.io.IOException: Cannot run program "vncserver" (in directory "/Library/Jenkins/jobs/flexUnitSampleCIProject/workspace"): error=2, No such file or directory
My gut feeling is this is a permissions issue since jenkins is running under the user _appserver
So I ran ran the following command in terminal
"sudo -u _appserver vncserver :6" and i get the following error
"vncserver: Wrong type or access mode of /Users/admin/.vnc."
However I read sudo doesn't inherit the home folder of the user (in this case "_appserver") and "su _appserver" dosen't work so I'm not sure where to go from here
Has anyone had any luck running flexUnit on mac server/tomcat/jenkins?
any ideas would be greatly appreciated
Have you told the VNC plugin where to find vncserver? It's under "Manage Jenkins" > "Configure System" > Xvnc.
However, depending on how the flash projector works, you may hit other issues because OSX doesn't really run X11, and in particular OSX versions of apps don't run X11;
See How to configure jenkins with xvnc on OSX Lion for maven project for more details on that.

Resources