Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
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 | ||||
---|---|---|---|---|
| ||||
<dependency> <groupId>org.jetbrains.teamcity</groupId> <artifactId>server-api</artifactId> <version>9<version>10.0</version> <scope>provided</scope> </dependency> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency> <groupId>org.jetbrains.teamcity</groupId> <artifactId>agent-api</artifactId> <version>9<version>10.0</version> <scope>provided</scope> </dependency> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<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 partsteamcity-server-plugin
- an empty plugin, includes the server plugin part onlyteamcity-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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
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