User Tools

Site Tools


dev-guide:add-content-registry-descriptor

GroIMP load doclet.xml files on startup that contains description of methods and classes.

Access Descriptor files in runtime

The loaded content is added in the runtime registry under /plugins/statics. This directory should have the three directories: methods, fields, and classes. The java objects used are ContentDescriptionType

Generating a doclet xml file

The doclets files are automatically created with the maven build of a project, if it contains the following information:

  • List of files to includes
  • Plugin execution in pom

Both steps are defined in the pom.xml file of your project. They are added in the <build> section.

Add files to be included

The included files are moved from the source code to the correct repository by maven with the plugin:

<plugin>
	<artifactId>maven-resources-plugin</artifactId>
		<version>3.0.2</version>
		<executions>
			<execution>
				<id>copy-class-for-xmldoc</id>
				<phase>generate-sources</phase>
				<goals>
					<goal>copy-resources</goal>
				</goals>
				<configuration>
				<outputDirectory>${basedir}/target/source-xmldoc/de/grogra</outputDirectory>
				<resources>
					<resource>
						<directory>src/main/java/de/grogra</directory>
						<includes>
							<include>rgg/Library.java</include>
 
                                                        ...
 
                                                        <include> OTHER FILES </includes>
 
                                                        ...
 
                                                <includes>	
					</resource>
				</resources>
				</configuration>
			</execution>
		<execution>
		<id>move-xmldoc</id>
		<phase>prepare-package</phase>
		<goals>
			<goal>copy-resources</goal>
		</goals>
		<configuration>
			<outputDirectory>${basedir}/target/classes/xmldoc</outputDirectory>
			<resources>
				<resource>
					<directory>${basedir}/target/site/apidocs/xmldoc</directory>
					<includes>
						<include>doclet.xml</include>
					</includes>
				</resource>
			</resources>
		</configuration>
		</execution>
	</executions>
</plugin>

Declare the plugin execution

This do not need to be modified:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <doclet>com.saxonica.xmldoclet.XmlDoclet</doclet>
          <useStandardDocletOptions>false</useStandardDocletOptions>
          <docletArtifacts>
	    <docletArtifact>
		<groupId>com.saxonica</groupId>
		<artifactId>xmldoclet</artifactId>
		<version>0.4.0</version>
	    </docletArtifact>
	  <docletArtifact>
		<groupId>com.github.javaparser</groupId>
		<artifactId>javaparser-core</artifactId>
	       <version>3.25.4</version>
	    </docletArtifact>
          </docletArtifacts>
          <doclint>none</doclint>
		<destDir>xmldoc</destDir>
	<overview></overview>
	<sourcepath>${basedir}/target/source-xmldoc</sourcepath>
	<additionalDependencies>
		<additionalDependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>${project.artifactId}</artifactId>
			<version>${project.version}</version>
			</additionalDependency>
		</additionalDependencies>
      </configuration>
	<executions>
		<execution>
		<id>generate-xml-doclet</id>
		<phase>process-classes</phase>
		<goals>
		<goal>javadoc</goal>
		</goals>
		</execution>
	</executions>
</plugin>
 

Complete pom file example

Look at the RGG plugin pom.xml file.

dev-guide/add-content-registry-descriptor.txt · Last modified: 2024/12/04 18:54 by gaetan