The DSD processor is used to generate java code from a Data Structure Definition file.
The preprocessor's task is to map a succinct Java-style "Data Structure Definition" file, in which the application programmer describes the schema of the database to which they expect their code to be attached, into a set of boilerplate Java source files implementing a statically-typed object-oriented API for that schema.
org.melati.LogicalDatabase.myproj.class=org.paneris.myproj.model.MyprojDatabase
The plugin compares the file timestamps of the DSD and the generated database base file (generated/MyProjectDatabaseBase.java). If the generated file is younger than the DSD then the plugin does not run.
To override this behaviour, when there is a new version of the plugin for example, add the following:
mvn -DcheckUptodate=false org.melati:maven-dsd-plugin:1.0-SNAPSHOT:generate
In order to shorten the amount of typing needed on the command line, you need to add the plugin's group ID to the list of group IDs searched by default.
To do this, you need to add the following to your \${user.home}/.m2/settings.xml file:
<pluginGroups> <pluginGroup>org.melati</pluginGroup> </pluginGroups>
At this point, you can run the plugin with:
mvn dsd:generate
If you use the Melati archetype or wish to retrofit the plugin then you need to add it to the build section of your POM:
<plugins> <plugin> <groupId>org.melati</groupId> <artifactId>maven-dsd-plugin</artifactId> <executions> <execution> <phase>process-sources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <dsdPackage>your-groupId.your-artifactId.model</dsdPackage> <dsdFile>your-artifactId.dsd</dsdFile> </configuration> </plugin> </plugins>
Maven plugins run with their own classpath, defined by their own POM.
If you need to import a dsd from another project, such as MelatiBoards, it is not sufficient to add MelatiBoards as a dependency in your main POM, you also have to add it to the plugin invocation section:
<plugins> <plugin> <groupId>org.melati</groupId> <artifactId>maven-dsd-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <dsdPackage>org.paneris.rimauresq.model</dsdPackage> <dsdFile>rimauresq.dsd</dsdFile> <classpath refid="maven.compile.classpath"/> </configuration> <dependencies> <dependency> <groupId>org.melati</groupId> <artifactId>MelatiSite</artifactId> <version>0.1</version> <scope>runtime</scope> </dependency> </dependencies> </plugin> </plugins>