ContextMapper / context-mapper-maven-plugin

Maven plugin for Context-Mapper generator.
1 stars 0 forks source link

Maven plugin #1

Open zambrovski opened 2 years ago

zambrovski commented 2 years ago

Hi folks,

I love the idea of a language for modelling context maps and would like to integrate it in my CI/CD. For this purpose, I would like to create an integration with Apache Maven and generate diagrams during build to be included into documentation.

Do you think it is reasonable? I could provide a PR with a Maven Mojo covering the same scope as the CLI... Probably, it is a good idea to separate it into an independent repository..

What is your opinion on that?

Cheers,

Simon

stefan-ka commented 2 years ago

Hi @zambrovski

Sure, I also have thought about that...

Currently I just do it by including the CLI as dependency...

    <dependencies>
        <dependency>
            <groupId>org.contextmapper</groupId>
            <artifactId>context-mapper-cli</artifactId>
            <version>${contextmapper.version}</version>
        </dependency>
    </dependencies>

...and then use the exec-maven-plugin to generate my stuff. Here an example for the PlantUML generator:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>generate-pumls</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.contextmapper.cli.ContextMapperCLI</mainClass>
                            <arguments>
                                <argument>generate</argument>
                                <argument>-i</argument>
                                <argument>sample-architecture/src/main/cml/sample-domain.cml</argument>
                                <argument>-g</argument>
                                <argument>plantuml</argument>
                                <argument>-o</argument>
                                <argument>sample-architecture/target/diagrams</argument>
                            </arguments>
                            <cleanupDaemonThreads>false</cleanupDaemonThreads>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

You could basically do the same to generate the Context Map. The generator parameter (-g) just had to be replaced with context-map, as documented here: https://github.com/ContextMapper/context-mapper-cli

But I totally agree that it could be done nicer with a Maven plugin. If you would want to do that, I would like to have it in a separate repository, yes. I could create one, just let me know when you are ready with your PR ;)

Best regards, Stefan

zambrovski commented 2 years ago

Great.. Will do soon...

zambrovski commented 2 years ago

Hi,

I created a repository with implementation here:

https://github.com/holixon/context-mapper-maven-plugin

I could transfer it into your org, if you like it.

Cheers,

Simon

zambrovski commented 2 years ago

By the way - currently it is only the basic integration. Let us start with that and extend it further afterwards... I envision not to specify single model files, but specify file sets for generation...

stefan-ka commented 2 years ago

Sure @zambrovski. You can initiate the transfer! Thank you very much for your work.

zambrovski commented 2 years ago

I initialized the transfer to you (@stefan-ka). Please accept it and then transfer it to the organization (it only works like this, since I'm not a member of ContextMapper)...

In the same time - I would join with pleasure.

I believe we could do some more interesting stuff together. Are you following the jmolecules project? I think those two projects should have more in common...

stefan-ka commented 2 years ago

Hi @zambrovski

Thank you very much!

I transfered the repo: https://github.com/ContextMapper/context-mapper-maven-plugin

I also invited you for the organization - I am always happy for new people that support us.

Regarding jMolecules: Of course, I know the library. I don't know if you have already seen this here? https://contextmapper.org/docs/architecture-validation-with-archunit/ We made an ArchUnit extension (https://github.com/ContextMapper/context-mapper-archunit-extension) to check the code against a CML model, based on JMolecules annotations. I am however open to any new ideas you have in mind ;)

Best regards, Stefan

stefan-ka commented 1 year ago

Open TODOs here: