How to develop a new gerrit plugin with eclipse?

205 views
Skip to first unread message

Bevin Ye

unread,
Dec 11, 2014, 1:48:13 AM12/11/14
to repo-d...@googlegroups.com, xuhui...@nsn.com
I met gerrit in a company level technical discussion introduced by a pretty girl.  She is hot and attractive then i feel love with her(I mean Gerrit:)). So i decide to develop a plugin. I read the document:


Now, i have set up the gerrit+eclipse, and i can run/debug the gerrit in eclipse.  The offical plugin under folder gerrit/plugins/* also are runable and debugable in eclipse. If i modify some java code, it reflects on the page immediately. That is really cool just like developing a popular web based app.

The problem is that i'm stuck in my own gerrit plugin. I generate the structure with maven followed the official doc and import it into eclipse as a maven project. Spent much time on how to  start and debug it like the official plugin in eclipse end with no solution. Is anyone could tell the steps or a document to help me setting up my poor plugin in eclipse?   

Really appreciated!!! 

David Ostrovsky

unread,
Dec 11, 2014, 8:55:44 AM12/11/14
to repo-d...@googlegroups.com, xuhui...@nsn.com

Am Donnerstag, 11. Dezember 2014 07:48:13 UTC+1 schrieb Bevin Ye:
I met gerrit in a company level technical discussion introduced by a pretty girl.  She is hot and attractive then i feel love with her(I mean Gerrit:)). So i decide to develop a plugin. I read the document:


Now, i have set up the gerrit+eclipse, and i can run/debug the gerrit in eclipse.  The offical plugin under folder gerrit/plugins/* also are runable and debugable in eclipse. If i modify some java code, it reflects on the page immediately. That is really cool just like developing a popular web based app.

The problem is that i'm stuck in my own gerrit plugin. I generate the structure with maven followed the official doc and import it into eclipse as a maven project. Spent much time on how to  start and debug it like the official plugin in eclipse end with no solution. 

Just build the plugin with "mvn package" and deploy it to $gerrit_site/plugins directory.

Zaro

unread,
Dec 11, 2014, 1:10:01 PM12/11/14
to David Ostrovsky, repo-d...@googlegroups.com, xuhui...@nsn.com
If you setup your plugin project as an in-tree build then you shouldn't need to import your plugin project into eclipse at all.  here's what I usually do:
1. add/checkout the plugin project into the gerrit 'plugin' folder
2. build gerrit core on cmd line
3. build the plugin on cmd line
4. execute the ./tools/eclipse/project.py 
5. open eclipse with gerrit project and make sure to add the plugin src files to your project.
6. if steps #1-4 ran without error then your eclipse project should be happy.  

note that the above steps require having buck setup.  you'll find that info in the docs.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Bevin Ye

unread,
Dec 11, 2014, 9:23:32 PM12/11/14
to repo-d...@googlegroups.com, david.o...@gmail.com, xuhui...@nsn.com
Thanks Khai. Your steps works even the plugin is maven based. But it likely need one more step:  copy the plugin jar which build in step3 into the folder gerrit_testsite/plugins. 
Then all works as expected!
 

在 2014年12月12日星期五UTC+8上午10时05分06秒,Bevin Ye写道:
Thanks for your reply. 
As you mentioned all the steps require having buck steps. But for creating a new plugin what i see in the document is all maven based, there is no BUCK file in the new plugin folder and  i did'n find the steps to create a plugin with buck instead of Maven. So how does it work with buck without a BUCK file inside the plugin folder? Do i need to add a BUCK file manually and then execute the ./tools/eclipse/project.py?

在 2014年12月12日星期五UTC+8上午2时10分01秒,Khai Do写道:
Reply all
Reply to author
Forward
0 new messages