Mon 17 June 2024

Week 24 update

Posted by ankur in Life (527 words, approximately a 3 minute read)

  • Share this post:

Setting up Vim for multi-repo Java projects

Because the NeuroML Java code is broken down into a number of different Java packages (org.neuroml.import, org.neuroml.export and so on), while working on jLEMS, I had to remind myself how to work on multi-repository/multi-project Java projects in Vim. I use YouCompleteMe (YCM) which is quite excellent for completion and code navigation. I had to figure out how to configure it to allow me to jump from one Java project to another (like one would do in an Eclipse workspace).

The documentation didn't really help me, unfortunately. It says to use Eclipse/Maven/Gradle configuration files that JDT (the engine YCM uses for Java) understands, but doesn't really say much about how to configure these. So, were the pom.xml files that our projects had enough? Didn't look like it---they do have dependency information, but only as packages, not as related source directories. So, I wasn't sure how to go about it. I tried to copy all my Java repositories into a "top level" (workspace style) folder and configure that as a "multi-project" Java maven package. I don't think that quite worked, or perhaps I didn't know how to quite set it up. I didn't want to have to create a new project either.

Eventually, I tried an Eclipse .project file to the top level directory which tells JDT what project/repository folders are related to each other. Again, I wasn't sure how to write this by hand, but turns out a minimal one is quite sufficient.

So, for example, my NeuroML/software folder looks like this:

AllenInstituteNeuroML/    inspyred/  libNeuroML/          netpyne/         NeuroMLCAP/             OpenCortex/          org.neuroml.model/                  pylems/
biosimulations-runutils/  jLEMS/     MDF/                 neuroConstruct/  NeuroMLlite/            org.neuroml1.model/  org.neuroml.model.injectingplugin/  pyNeuroML/
eden/                     jNeuroML/  modelspec/           NeuroML2/        neuroml-template-repo/  org.neuroml.export/  osb-model-validation/               pynsgr/
generateds-code/          LEMS/      morphology_include/  NeuroML_API/     neurotune/              org.neuroml.import/  pyelectro/

The main exporter code is in org.neuroml.export, but it references code in jLEMS and org.neuroml.import and so on. Adding a minimal .project file to this top level directory was enough:

<?xml version="1.0" encoding="UTF-8"?>

  • Share this post: