Skip to content

Mind Map annotation processor

Igor Maznitsa edited this page Dec 24, 2022 · 19 revisions

Since 1.6.0 it is possible to mark Java code by source level annotations. Special annotation processor can generate MMD files from sources.

Keep in mind that file links are built from root maven project for it I use special plugin which finds and provide root folder as property.

Some code-snipet for maven pom.xml

    <dependencies>
        <dependency>
            <groupId>com.igormaznitsa</groupId>
            <artifactId>mind-map-annotations</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.commonjava.maven.plugins</groupId>
                <artifactId>directory-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>directories</id>
                        <goals>
                            <goal>highest-basedir</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <property>mmd.basedir</property>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${project.basedir}</directory>
                            <includes>
                                <include>**/*.mmd</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
                <executions>
                    <execution>
                        <id>remove-all-mindmaps</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <annotationProcessorPath>
                            <groupId>com.igormaznitsa</groupId>
                            <artifactId>mind-map-annotation-processor</artifactId>
                            <version>${project.version}</version>
                        </annotationProcessorPath>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <compilerArg>-J-Djava.awt.headless=true</compilerArg>
                        <compilerArg>-Ammd.file.link.base.folder=${mmd.basedir}</compilerArg>
                    </compilerArgs>
                    <release>9</release>
                    <source>9</source>
                    <target>9</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Clone this wiki locally