importing jetbrains packages inside Kotlin build step

Hi - I'm trying to use the Teamcity API inside of a Kotlin script build step in my project (all in TC, nothing external). When I try to do something like import jetbrains.buildServer.serverSide.ProjectManager; for example

I get an error like  error: unresolved reference: jetbrains (script123456789.main.kts:1:8)

So what is the correct way to do this?  My goal is to get the object representing the currently running build so I can iterate through changes, etc. 

I do not want to use the REST API for this task. Thanks!

 

 

2
2 comments

Tried a few more things and still no luck. Is there anyone who can point us in the right direction please? 

0

Hi,

Use the @file:Repository and @file:DependsOn annotations to include the dependency. Replace the server-api version as needed. For more detailed information, please refer to kotlin help.

Here’s an example:

#!/usr/bin/env kotlin

@file:Repository("https://download.jetbrains.com/teamcity-repository")
@file:DependsOn("org.jetbrains.teamcity:server-api:2024.07")

import jetbrains.buildServer.serverSide.ProjectManager

 

0

Please sign in to leave a comment.