Icon

You are viewing the documentation of TeamCity 10.x and 2017.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt Include
Developing TeamCity plugins
Developing TeamCity plugins
nopaneltrue

You can easily develop TeamCity plugins with Maven.

On this page:

Table of Contents

Supported Maven versions

Both Maven 2 (2.2.1+) and Maven 3 (3.0.4+) are supported.

...

TeamCity Open API is available as a set of Maven artifacts residing in the JetBrains Maven repository (http://repositorydownload.jetbrains.com/allteamcity-repository). Add this fragment to the <repositories> section of your pom file to access it:

...

Code Block
xml
xml
<dependency>
  <groupId>org.jetbrains.teamcity</groupId>
  <artifactId>server-api</artifactId>
  <version>9<version>10.0</version>
  <scope>provided</scope>
</dependency>

...

Code Block
xml
xml
<dependency>
  <groupId>org.jetbrains.teamcity</groupId>
  <artifactId>agent-api</artifactId>
  <version>9<version>10.0</version>
  <scope>provided</scope>
</dependency>

...

Code Block
xml
xml
<dependency>
  <groupId>org.jetbrains.teamcity</groupId>
  <artifactId>tests-support</artifactId>
  <version>9<version>10.0</version>
  <scope>test</scope>
</dependency>

...

  • teamcity-plugin - an empty plugin, includes both the server and the agent plugin parts
  • teamcity-server-plugin - an empty plugin, includes the server plugin part only
  • teamcity-sample-plugin - the plugin with the sample code (adds a "Click me" button to the bottom of the TeamCity project Overview page)

Different released versions of the TeamCity server API are listed here.

Here is the Maven command that will generate a project for a server-side-only plugin depending on 910.0 TeamCity version:

Code Block
xml
xml
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE -DteamcityVersion=10.0

Here is the Maven command that will generate a project that contains both, the server and agent parts of a plugin and depends on 910.0 TeamCity version:

Code Block
xml
xml
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE -DteamcityVersion=10.0

Here is the Maven command that will generate a sample project on 910.0 TeamCity version:

Code Block
xml
xml
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-sample-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE -DteamcityVersion=10.0

You will be asked to enter the usual Maven groudId groupId, artifactId and version for your plugin. Please note, that artifactId will be used as your plugin (internal) name.
After the project is generated, you may want to update teamcity-plugin.xml in the root directory: enter display name, description, author e-mail and other information.

...

The target directory of the project root will contain the <artifactId>.zip file. It is your plugin package, ready to be installed to TeamCity..  You can install it to TeamCity or use the TeamClity SDK Maven plugin.

TeamCity SDK Maven plugin 

You can also use the TeamCity SDK Maven plugin allowing you to control a TeamCity instance from the command line and to install a new/updated plugin created from a Maven archetype