ContextMapper / context-mapper-dsl

ContextMapper DSL: A Domain-specific Language for Context Mapping & Service Decomposition
https://contextmapper.org/
Apache License 2.0
217 stars 28 forks source link

Command line mechanism to generate plantuml files #83

Closed ghost closed 1 year ago

ghost commented 5 years ago

Hi,

I have been going through docs and trying your examples to explore the possibility of using "Domain Driven Design" in our team. The examples are good and they work easily with Eclipse IDE.

It would be helpful if there is a command line way to generate plantuml files other than running Eclipse plug-in.

Please let me know if there is a command line way to generate plantuml files.

Regards KMK K.Manikandan

stefan-ka commented 5 years ago

Hi

Thank you for your input and your interest in our tool.

It is currently only possible within the Eclipse IDE. But we are aware of this issue... We plan to decouple the CML language from Eclipse, so that it is possible to compile and process CML files in 'standalone' Java applications. Once this is done it would be easy to also provide a command line interface.

I will work on this during the next few months, but I cannot make any promises when it will be available.

Thanks for creating the issue!

Best, Stefan

stefan-ka commented 5 years ago

Hi @kmanikandan-kmk

We haven't implemented a CLI yet, but the language including its tools (generators, etc.) are now available as standalone library in the Maven central. With the standalone library it is now possible to use the language and the generators outside Eclipse.

In our standalone example project you find a Java class PlantUMLGeneratorExample showing how you can simply generate the PlantUML diagrams out of your CML model with a few lines of code:

public class PlantUMLGeneratorExample {

    public final static String INSURANCE_EXAMPLE_URI = "./src/main/cml/Insurance-Example-Model.cml";

    public static void main(String[] args) {
        // Setup and loading CML file:
        ContextMappingDSLStandaloneSetup.doSetup();
        Resource resource = new ResourceSetImpl().getResource(URI.createURI(INSURANCE_EXAMPLE_URI), true);

        // Create the PlantUML generator
        PlantUMLGenerator generator = new PlantUMLGenerator();

        // Generate the diagrams into 'src-gen'
        JavaIoFileSystemAccess javaIoFileSystemAccess = FileSystemHelper.getFileSystemAccess();
        javaIoFileSystemAccess.setOutputPath("./src-gen");
        generator.doGenerate(resource, javaIoFileSystemAccess, new GeneratorContext());
    }
}

Maybe this could already help, if you are still interested in using the tool... You could write a Java program as shown above (maybe take input-file URI and output-directory as parameter), build an executable JAR, and call it from the command line.

We hope to provide a CLI tool in the future, but this takes more time and is not our first priority right now.

Of course we are open to contributions, if someone wants to start implementing the CLI ;)

stefan-ka commented 4 years ago

@kmanikandan-kmk, you can find a first very simple approach towards a CLI here: https://github.com/ContextMapper/context-mapper-standalone-example#cli

Still calling java directly but already quite comfortable...

stefan-ka commented 1 year ago

@kmanikandan-kmk, there is an official CLI now, you can find everything here: https://github.com/ContextMapper/context-mapper-cli Best regards, Stefan