Skip to content

Maven plugin for Kaitai: declarative language to generate binary data parsers

License

Notifications You must be signed in to change notification settings

valery1707/kaitai-maven-plugin

Repository files navigation

Maven Central License

Build Status Build status CircleCI GitHub Actions CI Status

LGTM total alerts LGTM language grade: Java

Scc Count Badge Scc Count Badge Scc Count Badge Scc Count Badge Scc Count Badge

DevOps By Rultor.com

Maven plugin for Kaitai: declarative language to generate binary data parsers.

This plugin has the following goals:

  • kaitai:generate: generate java-sources for kaitai-templates

Usage flow

  1. Add last version of kaitai-maven-plugin into plugins section
  2. Configure plugin execution with <executions><execution><id>generate</id><goals><goal>generate</goal></goals></execution></executions>
  3. Add last version of kaitai-struct-runtime into compile dependencies
  4. Add some kaitai templates into src/main/resources/kaitai
  5. (Optionally) Modify plugin configuration
  6. Build project with goal package or manually generate sources with goal kaitai:generate

Working examples

See kaitai-java-demo.

Plugin parameters

Name Type Since Description
skip boolean 0.1.0 Skip plugin execution (don't read/validate any files, don't generate any java types).

Default: false
url java.net.URL 0.1.0 Direct link onto KaiTai universal zip archive.

Default: Detected from version
version String 0.1.0 Version of KaiTai library.

Default: 0.8
cacheDir java.io.File 0.1.0 Cache directory for download KaiTai library.

Default: build/tmp/kaitai-cache
sourceDirectory java.io.File 0.1.0 Source directory with Kaitai Struct language files.

Default: src/main/resources/kaitai
includes String[] 0.1.0 Include wildcard pattern list.

Default: ["*.ksy"]
excludes String[] 0.1.0 Exclude wildcard pattern list.

Default: []
output java.io.File 0.1.0 Target directory for generated Java source files.

Default: build/generated/kaitai
exactOutput Boolean 0.1.5 Move root of packages directory structure exact inside configured output path and remove src item.

Default: false
packageName String 0.1.0 Target package for generated Java source files.

Default: Trying to get project's group or kaitai otherwise
executionTimeout Long 0.1.3 Timeout for execution operations.

Default: 5000
fromFileClass String 0.1.3 Classname with custom KaitaiStream implementations for static builder fromFile(...)
opaqueTypes Boolean 0.1.3 Allow use opaque (external) types in ksy. See more in documentation.
noVersionCheck Boolean 0.1.6 Allow to disable Java version check. For non-Windows only.

Default: false
noAutoRead Boolean 0.1.7 Allow to disable auto-running _read in constructor

Default: false

Useful commands

  • Execute integration test: ./mvnw clean verify -P run-its
  • Execute checkstyle (report will be stored in target/site/checkstyle.html): ./mvnw checkstyle:checkstyle