(Since TeamCity 8.0) it is easy to develop TeamCity plugins with Maven.
Supported Maven versions
Both Maven 2 (2.2.1+) and Maven 3 (3.0.4+) are supported
Open API in Maven Repository
TeamCity Open API is available as a set of Maven artifacts residing in JetBrains Maven repository (http://repository.jetbrains.com/all). Add this fragment to <repositories>
section of your pom file to access it:
Please note that only open API artifacts are present in the repository. If your plugin needs to use not-open API, corresponding jars should then be added to the project from TeamCity distribution as they are not provided in the repository.
Open API in the repository is split into two main parts:
Server-side API:
Agent-side API:
Please note, that API dependencies are used with provided
scope. This way you will avoid adding API and its transitive dependencies to the target distribution.
There is also an artifact to support plugin tests:
Maven Archetypes
For quick start with a plugin there are three Maven archetypes in org.jetbrains.teamcity.archetypes
group:
teamcity-plugin
- empty plugin, includes both server and agent plugin partsteamcity-server-plugin
- empty plugin, includes only server plugin partteamcity-sample-plugin
- plugin with sample code (adds a "Click me" button to the bottom of TeamCity project Overview page)
Here is Maven command that will generate project for server side-only plugin depending on 8.0 EAP TeamCity version:
Here is Maven command that will generate project that contains both, server and agent parts of plugin and depends on 8.0 EAP TeamCity version:
Here is Maven command that will generate sample project on 8.0 EAP TeamCity version:
You will be asked to enter usual Maven groudId, artifactId and version for your plugin. Please note, that artifactId will be used as you plugin (internal) name.
After the project is generated, you may want to update teamcity-plugin.xml
in root directory: enter display name, description, author e-mail and other information.
Finally, change directory to the root of the generated project and run
In the root's project target
directory you will get <artifactId>.zip
file. It is your plugin package, ready for installation to TeamCity. Just copy it to <TeamCity Data Directory>/plugins and restart the server.