aboutsummaryrefslogtreecommitdiffstats
path: root/config-class-plugin/README.md
blob: 87c6085375deee2df9d1c3187799e4f9d0425d4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
Vespa Config Generation
=======================

The vespa-configgen plugin is used to generate config-classes from .def files.

Userguide
---------
Put your .def files in `src/main/vespa-configdef`

Depend on this plugin in your `pom.xml`

    <dependencies>
      <dependency>
        <groupId>com.yahoo.vespa</groupId>
        <artifactId>vespa-configgen-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
      </dependency>
    </dependencies>

Add the following to the 'build' section of your `pom.xml`

    <build>
      <plugins>
        <plugin>
          <groupId>com.yahoo.vespa</groupId>
          <artifactId>vespa-configgen-plugin</artifactId>
          <executions>
            <execution>
              <id>config-gen</id>
              <goals>
                <goal>config-gen</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>

The .def files will now be processed during the generate-sources step, and produce output
in the `target/generated-sources/vespa-configgen-plugin` directory. This directory
is automatically added to the source path of your project.

It is possible to configure the location(s) of def-files, and the output of the generated sources.
Put the following configuration under the plugin in the build section:

    <build>
      <plugins>
        <plugin>
          <groupId>com.yahoo.vespa</groupId>
          <artifactId>vespa-configgen-plugin</artifactId>
          <configuration>
            <defFilesDirectories>etc, src/main/def-files</defFilesDirectories>
            <outputDirectory>target/generated-sources/vespa-configgen-plugin</outputDirectory>
          </configuration>
        </plugin>
      </plugins>
    </build>

To run only the config-gen goal from the command-line:
$ mvn com.yahoo.vespa:vespa-configgen-plugin:config-gen