![]() ![]() Import to the Chocolatey Community Package Repository! The packages found in this section of the site are provided, maintained, and moderated by the community. To obtain valid paths to the files after the plugin is installed, use the .PluginDescriptor class which implements the getPluginResourcesPath method otherwise TeamCity might have difficulties finding the plugin resources. When a plugin is unpacked on the TeamCity server, the paths to its resources change. Next we need to construct the path to our JSP file. The TeamCity open API provides the .WebControllerManager which allows registering custom controllers using the path to them: the path is a part of URL starting with a slash / appended to the URL of the server root. We'll create a simple controller which extends the TeamCity class and implements the BaseController.doHandle(HttpServletRequest, HttpServletResponse) method. Go to \demoPlugin\demoPlugin-server\src\main\java\com\demoDomain\teamcity\demoPlugin and open the AppServer.java file to create a custom controller: Create the controller and obtain the path to the JSP In the newly created demoPlugin-server\src\main\resources\buildServerResources directory, create the Hello.jsp file, e.g.ī. The plugin web resources (files that are accessed via hyperlinks and JSP pages) are to be placed into the buildServerResources subfolder of the plugin's resources.įirst we'll create the directory for our jsp: go to the demoPlugin-server\src\main\resources directory in IDEA and create the buildServerResources directory. We are going to make a controller class which will return Hello.jsp via a specific TeamCity URL. Open the pom.xml from the project root folder with Intellij IDEA. by modifying the corresponding attributes in the file. Open the teamcity-plugin.xml file in the project root folder with Intellij IDEA and add details, such as the plugin display name, description, vendor, and etc. The build directory contains the xml files which define how the project output is aggregated into a single distributable archive. TeamCity plugins are initialized in their own Spring containers and every plugin needs a Spring bean definition file describing the main services of the plugin. Src\main\resources\META-INF folder contains build-server-plugin-demo-plugin.xml, the bean definition file for our plugin. Src\main\resources includes resources controlling the plugin look and feel. The demoPlugin-server directory contains the plugin sources: * \src\main\java\zip contains the AppServer.java file The teamcity-plugin.xml file which is your plugin descriptor containing meta information about the plugin. The pom.xml file which is your Project Object Model The readme.txt file with minimal instructions to develop a server-side plugin The root of the demoPlugin directory contains the following: When the build finishes, you'll see that the demoPlugin directory was created in the directory where Maven was called. You will be asked to enter the Maven groudId, artifactId, version, package name and teamcityVersion for your plugin.ĭifferent released versions of the TeamCity server API are listed here.ĭemoPlugin will be used as the internal name of our plugin. Executing the following command will produce a project for a server-side-only plugin. We'll generate a Maven project from an archetype residing in the JetBrains Maven repository. We are using TeamCity 10 installed on Windows in our setup.ĭownload and install a Java IDE we are using Intellij IDEA Community Edition, which has a built-in Maven integration.ĭownload and install Apache Maven. Since you are going to use this machine to test your plugin, it is recommended that this TeamCity server is of the same version as your production server. Java 1.8 is required, the 32-bit version is recommended, the 64-bit version can be used.ĭownload and install TeamCity on your development machine. Set the JAVA_HOME environment variable on your system. To get started writing a plugin for TeamCity, set up the plugin development environment.ĭownload and install OpenJDK 8 (e.g. ![]() The Javadoc reference for the API is available here. The TeamCity Open API can be found in the JetBrains Maven repository. IntroductionĪ plugin in TeamCity is a zip archive containing a number of classes packed into a JAR file and plugin descriptor file. The plugin will return the "Hello World" jsp page when using a specific URL to the TeamCity Web UI. This document provides information on how to develop and publish a server-side plugin for TeamCity using Maven. See the list of existing TeamCity plugins created by JetBrains developers and community. The use of plugins allows you to extend the TeamCity functionality. ![]()
0 Comments
Leave a Reply. |