How to debug a new Plugin from IntelliJ IDEA?

435 views
Skip to first unread message

Javier Gómez

unread,
Aug 28, 2015, 11:26:40 AM8/28/15
to Kill Bill users mailing-list
Hi all,

I'm new to KillBill and I know there are a couple of posts explaining how to run a plugin, but I'd like to know if there is any kind of tutorial or step-by-step document to understand how to run a new plugin and debug the code from IntelliJ IDEA or similar.
I've been able to run the "meter-plugin" for example, moving the JAR file to the bundles folder, but I'm not able to reach the Resource with the endpoints. That's why I need to know how to debug the code and determine how to reach the Resource!

Could you help me there?

Thanks in advance.

Javier.

Pierre-Alexandre Meyer

unread,
Aug 30, 2015, 5:16:52 PM8/30/15
to Javier Gómez, Kill Bill users mailing-list
Hello Javier,

Typically, I have two IDEA projects open, one for Kill Bill and one for the plugin. Both are setup for JVM remote debugging (see the -d option of the start-server script: https://github.com/killbill/killbill/blob/master/bin/start-server#L51) and depending on what I'm trying to debug, I connect one of the projects.

You may be able to open both projects in the same IDEA window, but I've never tried it.

Does that help?

--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.
Visit this group at http://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/e80b949b-cc3b-4450-9dfb-3b99e2a5565d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Pierre

Javier Gómez

unread,
Aug 31, 2015, 11:18:31 AM8/31/15
to Kill Bill users mailing-list, javier.go...@gmail.com
Hello Pierre-Alexandre,

Thanks for your help! I was able to debug remotely the code of my plugin.

Thanks!!!

Javier.

hkr...@groupon.com

unread,
Sep 1, 2015, 4:15:31 AM9/1/15
to Kill Bill users mailing-list
Hi javier,

an even better way is to Open Kill Bill as a project in IntelliJ and add all the plugins that you are using as modules to the project.

Compared to the approach where you just have the plugin as project you can debug what is happening in Kill Bill and in the plugin in the same debugging session. And that is really helpful if you want to understand how things are connected.

Regards

Holger

Javier Gómez

unread,
Sep 1, 2015, 8:53:46 AM9/1/15
to Kill Bill users mailing-list
Hi Holger,

You are right! That's a better approach!! I'll give it a try. 
One question: in that case where you have the core KillBill and the plugin as a module....do you just run the main KillBill application in debug mode and it runs also your plugin? Before that, you have to build and copy the JAR of your plugin into /var/tmp/bundles......right?
Could you explain me that process?

Thanks for your help.

Regards,

Javier.

hkr...@groupon.com

unread,
Sep 2, 2015, 6:03:38 AM9/2/15
to Kill Bill users mailing-list
Hi Javier,

yes, you are right. I just run the Kill Bill application and I start it with the start-server script in debug mode (-s -d).

Each plugin has its own root directory in the file system, so there are not within the directory hierarchy of the kill bill application. I just add them as modules within IntelliJ.

I normally have unix soft links in /var/tmp/bundles that point to the installation directory for each plugin. So I don't have to copy them all the time.

This approach works for me.

Regards 

Holger

Javier Gómez

unread,
Sep 2, 2015, 10:09:56 AM9/2/15
to Kill Bill users mailing-list
Hi Holger,

Yes, I'm doing the same as you but the last part.
Could you share me the lines you have in your pom.xml to "copy" the generated JAR to another location?

Thanks!

Regards,

Javier.

Holger Kraus

unread,
Sep 4, 2015, 5:20:58 AM9/4/15
to Javier Gómez, Kill Bill users mailing-list
Hi Javier,

I never copy the generated JAR. I leave it where it is after it has been generated.

The only thing I do is to create a soft link for each plugin in the relevant /var/tmp/bundles…. folder
to the place where the generated JAR is located. 

An example:
cd /var/tmp/bundles/plugins/java/adyen/0.2.2
ln -s /Users/bob/killbill/killbill-adyen-plugin/target/adyen-plugin-0.2.2-SNAPSHOT.jar adyen-plugin-0.2.2-SNAPSHOT.jar

That is all. As long as I don’t change the version number the symlink always references the lastest version
of the plugin.

Regards

Holger
--
You received this message because you are subscribed to a topic in the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/killbilling-users/b_IRPmDAQ1U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to killbilling-us...@googlegroups.com.

To post to this group, send email to killbill...@googlegroups.com.
Visit this group at http://groups.google.com/group/killbilling-users.

Javier Gómez

unread,
Sep 4, 2015, 9:08:58 AM9/4/15
to Kill Bill users mailing-list, javier.go...@gmail.com
Hi Holger,

Thank you very much for that code!
Now I don't have to copy the JAR all the time.

Thanks!!

Best regards,

Javier.

yen.n

unread,
Oct 13, 2019, 11:02:35 PM10/13/19
to Kill Bill users mailing-list
HI, May I ask how to add a plugin as a module to the project? do I need to config in somewhere to make killbill recognize the plugin code as one of the module?

Pierre-Alexandre Meyer

unread,
Oct 14, 2019, 1:26:30 AM10/14/19
to yen.n, Kill Bill users mailing-list
Hello,

Holger was suggesting to open multiple Kill Bill projects as modules in the same IDEA project for debugging purposes. See https://www.jetbrains.com/help/idea/creating-and-managing-modules.html

Note however that Kill Bill won't know about these modules unless they are deployed as Kill Bill plugins (http://docs.killbill.io/0.20/plugin_development.html).

Hope this helps,


--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/1f0d7330-0a8f-45ad-a643-7c5849505f66%40googlegroups.com.


--
Pierre
Reply all
Reply to author
Forward
0 new messages