Search code examples
mavendependency-managementmps

Using maven as dependency management manager for MPS baseLanguage model?


Is it possible, instead of importing all runtime jars into MPS, to just consume external dependency management tool like maven and let it resolve and upload all needed libraries into MPS automagically?


Solution

  • Short answer: Nope

    Long answer: In theory you can use maven or gradle to fetch your dependencies and the transitive dependencies. For instance you can use the copy-dependencies task of maven to copy the artefacts to some locations. In gradle it's even easier. Then you select the folder in the runtime tab of your solution. At this point you will be disappointed because it did not add the folder but all jars in that folder as libs. There is no way to tell MPS to use all the jars from some location, it only references single jar files.

    The only way I could think of how this theoretically could work is by using gradle and after fetching the dependencies also programatically change the .msd file. Sync the jars in there with the jars that have been fetched. I'm not sure how to do this with maven though. But with groovy it shouldn't be that much of an issue.

    If you choose to try the gradle way we would be really happy to see a pull request adding this feature to our gradle plugin. ;)