ClassNotFoundException on Versioned Settings enabled

After enabling Versioned Settings for my project and clicking Load project settings from VCS button, it shows the following error:

Failed to apply changes from VCS to project settings (revision 34e1ccd6b6f0bf1d5aa92fce60e62351da36e17b): Settings. Please fix the errors in VCS and commit again. 

cent_budget: java.net.URLClassLoader [382]: java.lang.ClassNotFoundException: Settings
java.net.URLClassLoader.findClass(URLClassLoader.java:382)
java.lang.ClassLoader.loadClass(ClassLoader.java:424)
java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:817)
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
jetbrains.buildServer.configs.dsl.kotlin.KotlinRunner.runScript(KotlinRunner.java:370)
jetbrains.buildServer.configs.dsl.kotlin.KotlinRunner.run(KotlinRunner.java:211)
jetbrains.buildServer.configs.dsl.kotlin.KotlinRunner.generateProject(KotlinRunner.java:155)
jetbrains.buildServer.configs.dsl.kotlin.KotlinRunner.run(KotlinRunner.java:108)
jetbrains.buildServer.configs.dsl.DslGeneratorProcess.generateProjects(DslGeneratorProcess.java:141)
jetbrains.buildServer.configs.dsl.DslGeneratorProcess.run(DslGeneratorProcess.java:67)
jetbrains.buildServer.configs.dsl.DslGeneratorProcess.main(DslGeneratorProcess.java:40)

And here's my .teamcity/settings.kts:

package cent_budget

import jetbrains.buildServer.configs.kotlin.v2018_2.*
import jetbrains.buildServer.configs.kotlin.v2018_2.buildSteps.gradle

version = "2019.1"

project {
  buildType {
    id("cent_budget_build")
    name = "Build"
    steps {
      gradle {
        tasks = ":app:clean"
      }
      gradle {
        tasks = ":app:assembleRelease"
      }
    }
    params {
      param("system.somePassword", "67%9anws")
    }
  }
}

What's wrong with my settings.kts?

0
3 comments

Hi,

 

The "package" clause is wrong, you should not be adding one at all. TeamCity is trying to load it but it can't locate the class where it's expected because it's in a package where it shouldn't. Removing the package clause should make it work.

0

Hi Denis. I removed the "package" clause but is facing another problem now. I make a commit amending and the commit created by TeamCity is gone now on GitHub. The TeamCity complaints another error:

Cannot find previous revision of project: [cent_budget], skip updating settings to revision <sensitive-commit-hash>. Please commit current project settings into VCS first.

I don't want TeamCity to have permission committing to my repository so I replace its deploy key with a read-only one. Is it possible to load project settings with read-only permission?

0

As far as I am aware, TeamCity should be able to pull as a read-only client, but not explicitly, if it needs to write, it will still try to. That implies that you need to set up your workflow in a way where teamcity will not need to write into the repository. Any changes made in the UI need to be written into the repository via patches. Also, if you leave the repository in what teamcity sees as an inconsistent state, teamcity will consider that it might need to write there.

 

In particular, amending a commit is removing the original from the history and replacing it with a brand new one. This might make TeamCity, as you have experienced, find an inconsistency in the revision history and thus not be able to continue properly without intervention. While it might be useful for some scenarios, it's not great here, as teamcity attempts to keep track of changes and their progression through the commit history, and replacing one for another shows up as a different tree.

 

I'm not exactly sure about the issue you are describing, as I'm not sure I follow the order of operations. If you could describe step by step the initial state until the error is displayed, that would be helpful.

0

Please sign in to leave a comment.