I am Eric (Pengyu) Zhou, finished up my third year of Bachelor of computer engineering. I would like to start my tryout to contribute to XWiki during GSoC. Throughout the list of ideas of 2020, I find myself interested in a few of them, especially the Data Migration Framework.
For now, I pulled the code of the application migrator and built out a JAR file. By the reference in Development Practices/ Development Flow, I think I need an XWiki instance to be able to debug my code, is it a proper way of development of Contrib project?
Before jumping head first, I recommend you read the Getting Started section on the XWiki GSoC page and specially the guide document it links too. It should help you better understand what XWiki is, how to develop extensions for it, etc.
If you still have unclarities after going through that, don’t hesitate to ask.
I see the Eclipse debugging doc is currently a bit too advanced for regular needs and you don’t need to go through all that. Just handle it like a standard java web application:
Download XWiki locally (the Standard Flavor Preinstalled version is good for this type of testing/quick setup)
Deploy your jar (if you do it manually)
Start it in debug mode (start_xwiki_debug.sh/start_xwiki_debug.bat)
(optional) Install your extension with Extension Manager, in Administration (if you do it the clean way, rather than the manual way)
Open Eclipse (or your java IDE) and make sure you have imported the maven project (code) of your extension
Set your breakpoints and start a remote java debugging connection to localhost port 5005
Open your wiki in the browser (localhost:8080) and perform an action that is supposed to trigger your code and hit the breakpoint(s) that you’ve set.
Your IDE should get triggered once and execution of the thread should stop to your set breakpoint from where you can debug on.
Hello, @Enygma, I have installed the xwiki by extracting a WAR file in tomcat/webapps.
Also, I have imported the maven project of the migrator extension to eclipse.
so far, there is only one thing that I am not clear with:
How to enable the debug mode in 5005. Accroding to the post: https://dev.xwiki.org/xwiki/bin/view/Community/Debugging, I think I need to set those JVM options somewhere, is that correct?
Thank you ahead of time!
@EricPyZhou, I’ve updated my reply above where I typed up the wrong XWiki startup script for starting XWiki in debug mode. While this applies for the jetty/hsqldb distribution (Standard Flavor Preinstalled or zip package), you can still look at those startup scripts (or the Remote Debugging section in the documentation) and apply the same JVM options to your web container of choice (in your case, to the tomcat startup script - check the tomcat documentation for that, but it should be catalina.sh or catalina.bat that you need to update).
To keep things simple, I recommend you use the Standard Flavor Preinstalled zip package as you avoid dealing with other unnecessary problems in the early stages of you journey with XWiki.
@caubin , now here I am at the last step of all thing setup I think. the final thing is to import the component into the XWiki. Based on the doc: https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/WritingComponents/#HDeployingtheComponent, I uncommented those three lines and set the local maven repo to where the .m2/repo is. I pulled the code on github and did the ‘mvn install’. But the extension manager can not seem to search it. Also, I found nothing in the log. Can you please share your thoughts here about a recommended way of import?
Pure maven repositories are not searchable, only repositories backed by an XWiki Repository Application (like the one set up at extensions.xwiki.org). This means you need to use Advanced Search and enter the full group:artefactID ID of your extension and the version (probably the x.y.z-SNAPSHOT version).
Also note that SNAPSHOT versions are not auto-updated but cached, so if you want to deploy a change to your snapshot that is already installed in the wiki, you need to increment the version (e.g. x.y+1-SNAPSHOT; 2.3-SNAPSHOT → 2.4-SNAPSHOT), otherwise Extension Manager will see it as unchanged and not install your changes.
@Enygma@caubin That’s quite interesting. what I did at the end was to go through all jars, xars inside the maven repositories and then install them. Since all those extensions are installed in xwikidata folder (the permanent folder), I can import them