Maven and Ant
Hi,
when I started my work with MPS I found a page describing how to use maven or ant to automatically execute the MPS generator. I can't find this page anymore. Has maven support been removed?
when I started my work with MPS I found a page describing how to use maven or ant to automatically execute the MPS generator. I can't find this page anymore. Has maven support been removed?
Please sign in to leave a comment.
this is important for me and I would really (!!) appreciate an answer.
Has maven support been dropped? And if not, where can I find the plugin and documentation?
Best wishes
Yann Massard
Sorry for the delay with the answer, for some reason notifications from the forum stopped working.
We never had maven support, only ant tasks for generation. They are described in MPS 1.5 Documentation (somehow there were no links from the table of contents to this page, I fixed that).
--
Regards,
Julia
I have tried using the ant target (using maven-ant-run) but it does not seem to work with MPS2, as the directory structure has changed... There is no more platform folder. Instead, the enerate.ant.task.jar is in the language folder.
I suppose I need to open an issue...
The exception is:
This time I tried to do it with ant directly (although I am quite sure I got the things right with maven) and it throws the following Exception:
After that I switched to maven again to add the missing dependencies declaratively (see pom.xml). After adding quite a lot of dependencies I got the following exception:
Ok, at this point I am quite stuck...
Is there anybody getting ant builds to work?
Help greatly appreciated!
build.xml (474B)
pom.xml (5.5KB)
Thanks for your report. You can download fixed jar with ant tasks for MPS 2.0 M5 here http://confluence.jetbrains.net/download/attachments/39781994/generate.ant.task.jar Replace old jar in languages folder with this one.
--
Regards,
Julia
Julia:
our most projects are using maven,
why don't support maven tasks for generation?
The comment you're replying to is 8 years old.
You can call Ant scripts from Maven or Gradle. Maven has certain ideas about how it wants to build projects and what dependency scopes there are. These ideas don't quite match the way MPS works so native Maven support is difficult.
1) With Maven you have one language (Java) and you build code written in it. The Java default lifecycle is basically compile, test, package, deploy.
Now, with MPS, the lifecycle is more like: build language L1, use it to build language L2, use L1 and L2 to build L3, ... use all the languages built so far to build a solution written in this language. Maybe testing each of L1...LN in between.
Or: download multiple pre-built languages L1...LN from somewhere, and use them all together to build some solutions.
2) In MPS you have "uses language" dependencies, as in "model M uses a language L that has runtime R". This means that M depends on L if you want to build it, but the built output doesn't need to know anything about L, it only depends on R. In the Maven world the dependency scopes are compile, runtime, provided, and what I just described is kind of like depending on L with a "provided" scope (not compile because compile implies runtime and we don't need L at runtime), and depending on R with "runtime" or "compile" scope.
Due to 1) you will probably need several POMs for one MPS project.
Due to 2) you would need to duplicate all the MPS language/solution dependencies in Maven POMs.
It's all probably doable (meaning there isn't any reason why it would be theoretically impossible) but it's not clear what the benefits are, compared to the much simpler approach of calling out to Ant from Maven.