使用 maven 作为 MPS baseLanguage 模型的依赖管理器?

Using maven as dependency management manager for MPS baseLanguage model?

是否可以不将所有运行时 jar 导入 MPS,而只使用外部依赖管理工具(如 maven)并让它自动解析所有需要的库并将其上传到 MPS?

您可能应该使用 MPS Build Language:

Build Language is an extensible build automation DSL for defining builds in a declarative way. Generated into Ant, it leverages Ant execution power while keeping your sources clean and free from clutter and irrelevant details. Organized as a stack of MPS languages with ANT at the bottom, it allows each part of your build procedure to be expressed at a different abstraction level. Building a complex artifact (like an MPS plug-in) could be specified in just one line of code, if you follow the language conventions, but, at the same time, nothing prevents you from diving deeper and customize the details like file management or manifest properties.

简答:否

长答案:理论上您可以使用 maven 或 gradle 来获取您的依赖项和传递依赖项。例如,您可以使用 copy-dependencies task of maven to copy the artefacts to some locations. In gradle it's even easier。然后你 select 解决方案运行时选项卡中的文件夹。此时您会感到失望,因为它没有添加文件夹,而是将该文件夹中的所有 jars 添加为 libs。无法告诉 MPS 使用某个位置的所有 jar,它只引用单个 jar 文件。

我能想到这在理论上如何工作的唯一方法是使用 gradle 并且在获取依赖项之后还以编程方式更改 .msd 文件。将 jars in there 与已获取的 jars 同步。不过,我不确定如何使用 Maven 执行此操作。但是 groovy 应该不是什么大问题。

如果您选择尝试 gradle 方式,我们将非常高兴看到拉取请求将此功能添加到我们的 gradle plugin。 ;)