Open jisasava opened 4 years ago
I am not familiar with what you are doing specifically but I manage a non-trivial amount of TeamCity Kotlin config.
The lack of doc is frustrating and make using the DSL much harder than it needs to be. Here a couple hints that might help.
.teamcity
directory.Hope that helps.
@timdaman I also agree with your opinion of struggling with simple task as this is not relevant to other CI clients (such as Github CI, Jenkins or Gitlab CI).
Can you please elaborate more on that? If it is not possible to use such setup for my project in Android Studio then maybe it is possible in IntelliJ Idea. Unfortunately I was trying without luck in IntealliJ Idea Community edition. After right-clicking on the .teamcity
folder and choosing "add as Maven" I encounter another error, IDE cannot resolve the jetbrains
import packages and the Libraries are also not present. You can find the project here: https://github.com/jisasava/KotlinTeamcityDSL. Is it possible to configure this project to be working as expected in IntelliJ?
This approach is something which does actually makes the main purpose of configuration as code not useful. This "configuration as code" should be the main trait of switching from TeamCity control panel in web (GUI) to the code. As you describe I would still need to work with TeamCity UI mainly, and just copy pasting the configuration as a plain text (code). Thank you for your engagement to my question I really appreciate it.
I am short on time so I am not going to write a detailed answer right now.
You issue with adding the Maven project is probably related to the teamcity-server
config in the pom.xml
.
To initially create a project it is best to download a empty one from the TeamCity server in question. There are a couple reasons.
There are several versions of the DSL/API. When you download the the settings as generated on the server it will automatically set this to a version supported by the server.
The TeamCity server runs a secret Maven server. In the pom.xml
the server generates it sets paths to download the libraries from itself. I noticed when looking at your linked pom.xml
it is referencing http://localhost:8111/app/dsl-plugins-repository
. If you did use the server to generate this pom.xml
ensure that the server is running and reachable at the address configured in the pom.xml
when you are importing/adding it.
@timdaman Hello, thanks again for your answer. I've tried to firstly run the server as you suggested (I am using docker image and configuration exact as described here: https://nad.dev/posts/2020/01/06/teamcity-server-agent-docker.html
I've just tried to open an alone .teamcity
folder in the IntelliJ Idea Community Edition. Unfortunately still I cannot setup it properly, I am getting unresolved errors:
Maybe you can describe me the exact steps how can I run the code in IntelliJ?
@timdaman I've also created some video which shows (perhaps in more details) the problem that I am encountering: https://www.youtube.com/watch?v=t4AboFhtb60&t=3s
I am trying to setup a TeamCity project configuration using Kotlin DSL. I've created a sample project in TeamCity pointing to just an empty Android Studio project with empty Activity which I 've published in the github. I've enabled Kotlin DSL configuration on the TeamCity for that project.
After that TeamCity has commited a
.teamcity
folder to my Android Studio project. However, when I am inspecting the code insettings.kts
the IDE is not giving me any hints and I cannot use the autocompletion for the Kotlin DSL configuration code. For example I cannot navigate to implementation of functiontriggers
, cannot use autocompletion etc.I was trying to follow https://blog.jetbrains.com/teamcity/2019/03/configuration-as-code-part-1-getting-started-with-kotlin-dsl/#commento-login-box-container but unfortunately I cannot right-click on the
pom.xml
file and don't see any option toAdd as Maven
. In addition I cannot see any External Libraries added to my project related to TeamCity DSLI am using Android Studio 4.0
Is it possible to use such configuration in my case? If so, can you please help me how I should properly setup it in Android Studio to have such benefits in Android Studio? Android Studio project uses Gradle by default