Wiki

Clone wiki

md-maven / Home

Mavenize the Moneydance libs

The main goal is to have a parent POM file so that in your Maven project you can just do

  <dependencies>
...
    <dependency>
      <groupId>com.moneydance.maven</groupId>
      <artifactId>md-parent</artifactId>
      <version>2020.1917</version>
      <type>pom</type>
    </dependency>
  </dependencies>
and things will simply work.

This sounds like a lot of overhead work but trusts me. Setting this up will make developing extension in MD a lot more pleasant. Especially if your day-to-day environment is in Maven.

  • You can launch a dev instance of MD without having to worry about messing your day-to-day (production) MD instance.
  • Most IDE (Eclipse, IntelliJ IDEA ...) nowadays will support import Maven projects.
  • You can switch between release with a single line change in the pom.xml. This will make it very easy to handle supporting multiple version of MD in a single code base (create branch MDv1, MDv2 and so on).
  • Your extension project will look cleaner. It will be easier to create unit tests.

What you need to do

  • Clone the following repo
    git clone https://bitbucket.org/hleofxquotesteam/md-maven.git
    cd md-maven
    
  • Install the MD Maven plugin: md-maven-plugin. We will use this plugin in the next step (md-maven-install)
    cd md-maven-plugin
    mvn clean install
    
  • Then run md-maven-install to download and install the MD Maven lib jars to your local repo. Note: this step will download the current MD previewdl distribution (about 140MB). It is fairly large, so please patient.
    cd ../md-maven-install
    mvn clean install
    
  • Now build md-maven-utils to verify that the MD dependencies were installed correctly
    cd ../md-maven-utils/
    mvn clean package
    

If you are seeing error

[ERROR] Failed to execute goal on project md-maven-utils: Could not resolve dependencies for project com.hleofxquotes.md:md-maven-utils:jar:1.0.0-SNAPSHOT: Failure to find com.moneydance.maven:md-parent:pom:2020.1917 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
That means your copy of md-maven-utils is slightly older than the current version of MD you just downloaded in the previous step. In most cases, you just need to make a small update

  • Get the current version
    $ cat ../md-maven-install/download/version.txt 
    2020 (1918)
    
    Then update file poxm.xml, change
        <moneydance.version>2020.1917</moneydance.version>
    to
        <moneydance.version>2020.1918</moneydance.version>
    

Use it yourself

Now try a simple Maven project,

  • Add to your project POM
      <dependencies>
    ...
        <dependency>
          <groupId>com.moneydance.maven</groupId>
          <artifactId>md-parent</artifactId>
          <version>2020.1917</version>
          <type>pom</type>
        </dependency>
      </dependencies>
    
  • Create a class that has reference to MD class. Something like this
    package com.xyz.java.md;
    
    import com.moneydance.apps.md.controller.Main;
    
    public class MdMain extends com.moneydance.apps.md.controller.Main {
        public static void main(String[] args) {
            Main.DEBUG = true;
        }
    }
    

See also

Updated