Build Unity project with Jenkins failed
Asked Answered
I

6

14

I'm trying to build Unity project with Jenkins on Mac OS Server. But when I try to run the following script

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode ${PROJECT_PATH} -executeMethod BuildScript.DevelopmentBuild

The script shows this,

_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.

Does anyone knows how to fix the problem?

Internalize answered 20/12, 2012 at 6:39 Comment(1)
Now I fixed the problem. I moved Jenkins CI from /Library/LaunchDaemons/ to /Library/LaunchAgents/. Also I made jenkins user and install Unity3D on jenkins user. Then keep logged in jenkins user.Internalize
S
13

Try write from Terminal:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/org.jenkins-ci.plist

Then log out and log in again.

Now Jenkins will run as agent and can access WindowServer.

Supersaturate answered 4/3, 2013 at 13:15 Comment(2)
I had to restart my machine after this change. Logging out and logging in wasn't enough. Also I don't have Jenkins configured to run on machine startup, so I had to run sudo launchctl load /Library/LaunchAgents/org.jenkins-ci.plist after restarting.Millian
Did also had to restart the machine, but after that it just worked fine! thxPathognomy
S
4

Make sure you have -nographics parameter among your startup parameters

Selfesteem answered 26/6, 2015 at 14:4 Comment(0)
T
1

I tried

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/org.jenkins-ci.plist

Then Restarted my Mac

And then sudo launchctl load /Library/LaunchAgents/org.jenkins-ci.plist after restarting

It worked

Tetany answered 16/9, 2019 at 10:29 Comment(0)
H
0

I had this same issue. The problem is with how Jenkins and Unity work individually. The only way I could find a cleaner work around was:

  1. Ideally have your Jenkins master only do assignments to slave and do not build anything by itself. So your slaves would build the project.
  2. In case above is not easily doable here is a quick workaround:
    • On your Jenkins master create a slave.
    • Add a label to execute your Unity project on the newly created slave.
    • Configure the job to run on dedicated slave that you created above.
    • All works now!
Hypotonic answered 27/3, 2015 at 13:38 Comment(0)
F
0

You also get this error if the user you are running as is not currently logged in graphically.

Forge answered 28/7, 2020 at 13:45 Comment(0)
E
-1

It looks like you're missing the --projectPath option prior to specifying your project's path?

Executioner answered 14/1, 2013 at 11:14 Comment(1)
I tried with --projectPath option as Unity -batchmode -quit -projectPath "${UNITY_PROJECT_PATH}" -executeMethod BuildScript.DevelopmentBuild. But won't build.Internalize

© 2022 - 2024 — McMap. All rights reserved.