Getting java.awt.HeadlessException after run gui tests on Jenkins - eclipse

After running gui tests on Jenkins I am getting java.awt.HeadlessException on build Jenkins:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
I am using xvfb in pipeline Jenkins (script), eclipse & maven.
How coud I solve this issue via Jenkins file (script) or maven pom or in another way?
Why am I getting this exception?

Somewhere in your pipeline you probably need to have export DISPLAY=:0.0 or something similar.

Related

Why does Jenkins change my workspace path?

i have installed Jenkins on Windows 10 and each time i try to execute a maven project or just try to execute mvn clean test (command line), Jenkins decides that my new workspace should be: C:\Windows\system32\config\systemprofile\eclipse-workspace\ while my project is in C:\Users\username\eclipse-workspace.
Jenkins starts in the directory C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace\projectName and even if i run a cd command i will have this problem:
The driver executable must exist:
C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe
My chrome driver is not there obviously but it's in C:\Users\userName\eclipse-workspace\projectName\drivers\chromedriver.
It looks like than Jenkins changes my user.home.
I went to config file and set:
<workspaceDir>C:\Users\userName\eclipse-workspace</workspaceDir>
but it's still looking for the driver in C:\Windows\system32\config\systemprofile\eclipse-workspace\projectname\drivers\chromedriver\chromedriver.exe
This part: C:\Windows\system32\config\systemprofile\ is obtained using in Java System.getProperty("user.home"). Running it with Jenkins seems to modify it.
Why is it looking for my driver there?
Why can't it just stick to my workspace folder?
How can i solve this?
Thank you
I think i solved it. I was running under Local System Account
https://jenkins-le-guide-complet.github.io/html/sect-windows-service.html#fig-hudson-windows-service-config
I had edit the service as shown in the link.

How to set an environment variable in the middle of a build pipeline execution?

I have a project that uses create-react-app for creating my react app, and I'm using Azure DevOps to build the project and run tests, but there is a problem.
In order to run tests in a CI environment, you have to create an environment variable CI=true, but this has the effect that the build script fails if warnings are found (and my project have warnings).
So my idea is running the build script first, then set the variable, then run the tests, but I haven't found how to set the variable.
Add a Powershell task in the middle of the build and set the variable there:

jenkins + ghprbhook - how to set status message?

I've installed the ghprbhook plugin to my jenkins system. It triggers when I send a PR but isn't setting the result text properly. The 'success' / 'failure' message is working but the rest is Build finished. No test results found.
The disconnect seems to be between the gradle build plugin and the ghprbhook service. In the ghprbhook source it's checking for hudson.tasks.junit.TestResultAction to be set and apparently it isn't.
Question:
Is it possible to have gradle set the appropriate values? If so, how?
Turns out that I was looking in the wrong place. The way to get useful values to show up in github is to add the Publish JUnit Test Result Report post-build step to your jenkins job. Assuming that you have gradle and junit outputting xml you should see the output in github when you build.

Jenkins Error: Process Leaked Filed Description when running an ANT call

I'm currently receiving a "Process Leaked File Description" error whenevery I'm trying to call my ANT script from a Perl script in Jenkins. The job actually finishes currectly, but it's erroring in Jenkins. The Perl script calls something similar to
exe("CALL ant -buildfile C:\\build.xml");
I have tried googling this Jenkins issue elsewhere and none of the things I have tried appear to work. Anyone have anything else I can try?
You should not call ant from a perl script.
Jenkins has a plugin for ant builds.
If your script generates the build.xml you can set up two actions in your project config. The first with the script to generate the buildfile and the second to execute ant on it.

How do I run build Release from the command line in Eclipse / Flash Builder

Is there a way to run a Export Release build from the command line in Flash Builder (Eclipse)?
More Context
Flash Builder has debug, run and build release commands or configurations (not sure what they're called). I want to put Flash Builder on the server and invoke the build release configuration from the command line.
You don't need Flash Builder on the server. You can do it with the Flex SDK, Java and Apache ANT installed on the server. If it is a Windows server you can set it up to run like this:
Create an ANT script to update from the repository, then build the Flash app.
Create a .bat file to run the ANT build (literally just a text file 'build.bat' in the folder with the build.xml that just says 'ant' in it).
Set up a scheduled task to run the build.bat at whatever interval you desire, or, if you have SVN on the same server you can set up a post commit hook to run that scheduled task so when a person commits to the repo, the build script will run and the new version can be viewed on the dev server.
I have an ANT script that also will email all devs if the build fails to let everyone know who broke the build, so they can take care of it. If you message me back I would be happy to post a zip for you with my ANT script files you can use an example.
EDIT: I've posted the files to GitHub in case anyone else needs them. https://github.com/royaldigit/ant-flash-build