...
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 |
---|
<repository> <id>jetbrains-all</id> <url>http://repositorydownload.jetbrains.com/all<teamcity-repository</url> </repository> |
Please note that only open API artifacts are present in the repository. If your plugin needs to use the not-open API, the corresponding jars should then be added to the project from the TeamCity distribution as they are not provided in the repository.
...
The server-side API:
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency> <groupId>org.jetbrains.teamcity</groupId> <artifactId>server-api</artifactId> <version>8<version>9.0</version> <scope>provided</scope> </dependency> |
The agent-side API:
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency> <groupId>org.jetbrains.teamcity</groupId> <artifactId>agent-api</artifactId> <version>8<version>9.0</version> <scope>provided</scope> </dependency> |
...
There is also an artifact to support plugin tests:
Code Block | ||||
---|---|---|---|---|
| ||||
<dependency> <groupId>org.jetbrains.teamcity</groupId> <artifactId>tests-support</artifactId> <version>8<version>9.0</version> <scope>test</scope> </dependency> |
...
For a quick start with a plugin, there are three Maven archetypes in the org.jetbrains.teamcity.archetypes
group:
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)
Here is the Maven command that will generate a project for a server-side-only plugin depending on 89.0 TeamCity version:
Code Block | ||||
---|---|---|---|---|
| ||||
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=http://repositorydownload.jetbrains.com/allteamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=8RELEASE -DteamcityVersion=9.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 89.0 TeamCity version:
Code Block | ||||
---|---|---|---|---|
| ||||
mvn archetype:generate -DarchetypeRepository=http://repositorydownload.jetbrains.com/allteamcity-repository -DarchetypeArtifactId=teamcity-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=8RELEASE -DteamcityVersion=9.0 |
Here is the Maven command that will generate a sample project on 89.0 TeamCity version:
Code Block | ||||
---|---|---|---|---|
| ||||
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=http://repositorydownload.jetbrains.com/allteamcity-repository -DarchetypeArtifactId=teamcity-sample-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=8RELEASE -DteamcityVersion=9.0 |
You will be asked to enter the usual Maven groudId
, 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.
Finally, change the directory to the root of the generated project and run
Code Block | ||||
---|---|---|---|---|
| ||||
mvn package
|
The target
directory of the project root will contain the <artifactId>.zip
file. It is your plugin package, ready to be installed to TeamCity.