Where to start?

Hello,

I may sound dumb, but I pretty much spent the whole day trying to understand how to develop a TeamCity plugin. I don't have Java backround, so that makes it harder, but I want to add a new tab and show hello world in TeamCity.

I was reading this document, but I can see what it's doing but what do I do with the code? Do I need to compile it into something? Can someone help me with step by step example of how I could add a UI in TeamCity?

5 comments
Comment actions Permalink

Hello,

I've got to the point where I could download the sample project using Maven and package it and deploy it to my test TeamCity. I can now see "Click me!" button at the lower left corner of the overview page.

I am interested in adding my custom tab in the following page but what I did to experiment has not worked.

2015-05-01_11-15-20.png

So I added a java class called MyProjectTab which extends ProjectTab. Here is the code.

package CustomTabs;

import jetbrains.buildServer.serverSide.ProjectManager;
import jetbrains.buildServer.serverSide.SProject;
import jetbrains.buildServer.users.SUser;
import jetbrains.buildServer.web.openapi.PagePlaces;
import jetbrains.buildServer.web.openapi.project.ProjectTab;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class MyProjectTab extends ProjectTab {

     protected MyProjectTab(String tabCode, String title, PagePlaces pagePlaces, ProjectManager projectManager, String includePath) {
         super("myCustomProjectTab", "Hello Custom Project Tab", pagePlaces, projectManager, "baka.jsp");
     }

     @Override
     protected void
fillModel(Map<String, Object> model, HttpServletRequest request, SProject project, SUser user) {

     }
}

I also added the class in build-server-plugin-HelloTeamCityPlugin.xml.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans default-autowire="constructor">                                   
   <bean id="sampleExtension" class="HelloGroup.button.PageExtension"/>
   <bean id="ahoExtension" class="CustomTabs.MyProjectTab"/>
</beans>


I ran "mvn package", generated the plugin zip file and deployed it to TeamCity. Of course, I restarted TeamCity Server service as well, but the tab doesn't show up. What am I doing wrong?
0
Comment actions Permalink

Hello Hayato,

Sorry for the delay replying to your posting.

It seems like "Click me!" button form the sample Maven plugin actually does nothing (redirects to missing helloUser.html page).


General flow of the plugin development is described in the getting started section.

To get a plugin with more example code you can use dev package sample plugin.

You can try a simple Maven sample project which adds a project tab attached.



Attachment(s):
projectTab_src.zip
0
Comment actions Permalink

Hello, Yegor.

Thank you very much for your reply. I'm still having an issue with the plugin, but I'm seeing the issue now. Here is what I did.

  1. Downloaded your sample code.
  2. Extracted to a directory.
  3. ran "mvn package". (I use maven 3.3.3 with JDK 8)
  4. Generated the plugin zip file and deployed it to my test TeamCity server.


The result is that it still doesn't work. I unzipped the generated plugin code and I noticed that I didn't see any baka.jsp place anywhere in the zip file. Here is what I saw.

projectTab - server (folder)
                  |--projectTab-server-1.0-SNAPSHOT.jar
                  - teamcity-plugin.xml

That's all that was included in the plugin zip file. I'm thinking that is the problem. All I did was "mvn package" to generate the plugin zip file. Should I try a different command or any other way you can suggest?

0
Comment actions Permalink

Sorry, I was too fast. The files are in the jar file, so I don't think the plugin file generation was the issue. I will attach the plugin zip file to this post, so could you please take a look at it?



Attachment(s):
projectTab.zip
0
Comment actions Permalink

I'm very sorry for my multiple posts, but I finally got a new tab to show up! I am so happy! :D

I'm not sure if it was some cached stuff that was preventing it from showing up, but I tried to clean up ROOT/plugins folder. I just deleted the apparently old plugins from there. Deployed the sample plugin you gave me and started TeamCity server and boom, it worked! I guess I didn't do anything wrong, but just happened to have this issue.

Again, thank you very much for your help. I'm sure I will post more questions as I really start to get into the development.

0

Please sign in to leave a comment.