Build error after TeamCity 10 Upgrade


We are testing an upgrade to TeamCity 10 and a bunch of our builds are throwing this error and I'm not entirely sure how to track it down.


Error: Could not find or load main class ""


This is the entire build log.


inalize build settings
[14:56:08]Collecting changes in 1 VCS root
[14:56:33]Clearing temporary directory: /home/linuxadmin/buildAgent/temp/buildTmp
[14:56:33]Publishing internal artifacts
[14:56:33]Checkout directory: /home/linuxadmin/buildAgent/work/633e02c7e346144e
[14:56:33]Updating sources: server side checkout
[14:56:34]Resolving artifact dependencies
[14:56:34]Step 1/1: Create Update (Gradle)
[14:56:34][Step 1/1] Starting: bash /home/linuxadmin/buildAgent/work/633e02c7e346144e/gradlew --init-script /home/linuxadmin/buildAgent/plugins/gradle-runner/scripts/init.gradle -PproductVersion=6.5 -PsuDrvVersion=+ -PfacAppVersion=+ -PivuSalVersion=+ -Dorg.gradle.daemon=false -s clean :superset:buildAll
[14:56:34][Step 1/1] in directory: /home/linuxadmin/buildAgent/work/633e02c7e346144e
[14:56:34][Step 1/1] Error: Could not find or load main class ""
[14:56:34][Step 1/1] Process exited with code 1
[14:56:34][Step 1/1] Step Create Update (Gradle) failed
[14:56:34]Publishing internal artifacts
[14:56:34]Publishing artifacts
[14:56:16]Build finished

Hello Alexander,

Could you please try to run the same build via command line on the same agent? Does it run successfully?

Could you please attach screenshot of the build step settings and teamcity-agent.log file? On what OS does the agent run?




Thanks for the reply. If I run it on the agent directly then yes the build works as expected.

Here's the build step settings
Here's a screen shot of the log at the time that this build ran.

The agent is running on a ubuntu 16.04.1 server with the latest JDK 8 101 installed.


Hello Alexander,

What verion of Gradle is configured in Gradle Wrapper?




We are using 2.14.1 on this particular project.




Hello Alexander,
Could you please enable debug logging on the build agent (instruction here ), reproduce the issue and attach full build log and teamcity-agent.log file.



I have the files, but can only attach images to this post. Can I email them to you?






I uploaded them to the support site named:


acarman-teamcity-agent.log (477 kb)
acarman-Update_All_Snapshot_All_Superset_115.log (4 kb)

Thank you for the logs.

Please, make a change a small change to script "gradlew" 

add line 

echo "Effective opts are:[${JVM_OPTS[@]}]"

right above the last one (starting wiht "exec ... ")

commit to repository (or do remote run). The build log should contain new string starting "Effective opts". Please post this line here.




It comes back blank like:


[Step 1/1] Effective opts are:[]



Is there a way I can escalate this issue to the technical support team. Most of our developers have upgraded to the latest version of Idea and can no longer remote run in TeamCity 9. We need to push through this upgrade, but cannot until we can verify that our builds work.




Hi Alexander,

Since Nikita (TeamCity developer responsible for Gradle support) is on vacation, so I'd try to investigate your problem.

>Most of our developers have upgraded to the latest version of Idea and can no longer remote run in TeamCity 9.

They can update TeamCity plugin from plugins repository right in IDEA, that plugin is compatible with TeamCity servers 9.0 - 10.0.


It's quite unexpected that you have output '[Step 1/1] Effective opts are:[]' since gradlew of version 2.14 adds '-Dorg.gradle.appname=$APP_BASE_NAME' in the end, just before executing java, so it should be at least '[Step 1/1] Effective opts are:[-Dorg.gradle.appname=gradlew]'

Ensure your 'gradlew' is new one (2.14 or 2.14.1)

Here's gradlew from 2.14.1 patched with logging related to env variables.




The output was:

[Step 1/1] in directory: /home/linuxadmin/buildAgent/work/633e02c7e346144e
[07:06:22][Step 1/1] DEFAULT_JVM_OPTS=
[07:06:22][Step 1/1] JAVA_OPTS=
[07:06:22][Step 1/1] GRADLE_OPTS=""
[07:06:22][Step 1/1] Effective opts are:[ -Dorg.gradle.appname=gradlew]
However your suggestion got me thinking so I regenerated a new wrapper setup from gradle 2.14.1 and put it into this project. Our build started working after I did that. I which is ever so odd because it works fine without that on TeamCity 9.

Please sign in to leave a comment.