Skip to content
Pascal S. de Kloe edited this page Apr 7, 2017 · 5 revisions

Maven

Fancy developers might want code compilation to be part of the build. The Colfer Maven plugin is available from the central repository. It holds compilers for Linux, OSX, OpenBSD and Windows on the AMD64 architecture. No additional software is required. The plugin works well with popular IDEs and Maven's javadoc:jar and source:jar.

Configuration Options

lang

The target language. The default is Java.

schemas

The source files. Directories are scanned for files with the colf extension. The default is src/main/colfer.

formatSchemas

Normalizes schemas on the fly. The default is false.

packagePrefix

Adds a package prefix. Use slash as a separator when nesting.

sizeMax

Sets the default upper limit for serial byte sizes. The expression is applied to the target language under the name ColferSizeMax. The default is 16 * 1024 * 1024.

listMax

Sets the default upper limit for the number of elements in a list. The expression is applied to the target language under the name ColferListMax. The default is 64 * 1024.

superClass

Makes all generated classes extend a super class. Use slash as a package separator. Java only.

sourceTarget

Use a specific destination base directory. The default is ${project.build.directory}/generated-sources/colfer.

Complex configuration example

<plugin>
	<groupId>net.quies.colfer</groupId>
	<artifactId>colfer-maven-plugin</artifactId>
	<version>1.10</version>
	<configuration>
		<sizeMax>2 * 1024</sizeMax>
		<listMax>99</listMax>
		<formatSchema>true</formatSchema>
	</configuration>
	<executions>
	<execution>
		<id>colf-java</id>
		<goals><goal>compile</goal></goals>
		<configuration>
			<packagePrefix>com/example</packagePrefix>
			<superClass>com/example/BeanParent</superClass>
		</configuration>
	</execution>
	<execution>
		<id>colf-ecma</id>
		<goals><goal>compile</goal></goals>
		<configuration>
			<lang>js</lang>
			<sourceTarget>${project.build.directory}/${project.build.finalName}/script</sourceTarget>
		</configuration>
	</execution>
	</executions>
</plugin>