Usage

Configuration examples

Minumum configuration required

The the example shows minimum configuration with path to juic>> binary and <<<sourceDirectory specified.

<plugin>
 <groupId>pl.swmud.ns.qtjambi</groupId>
 <artifactId>juic-mvn-plugin</artifactId>
 <version>1.0</version>
 <executions>
  <execution>
   <id>juic</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>compile</goal>
   </goals>
   <inherited>false</inherited>
   <configuration>
    <juicPath>/usr/qt/qtjambi-4.5.0/bin/juic</juicPath>
    <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
   </configuration>
  </execution>
 </executions>
</plugin>

One could say there is no outputDirectory required parameter specified, however it has a default value, so it is not needed. Actually sourceDirectory is redundant as well, because its default value is the same as the one specified in the above example, so we could simply write:

<plugin>
 <groupId>pl.swmud.ns.qtjambi</groupId>
 <artifactId>juic-mvn-plugin</artifactId>
 <version>1.0</version>
 <executions>
  <execution>
   <id>juic</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>compile</goal>
   </goals>
   <inherited>false</inherited>
   <configuration>
    <juicPath>/usr/qt/qtjambi-4.5.0/bin/juic</juicPath>
   </configuration>
  </execution>
 </executions>
</plugin>

Please note that both above configuration will run multiple threads. Separate thread for each file.

More complex configuration

This example presents more parameters in use.

<plugin>
 <groupId>pl.swmud.ns.qtjambi</groupId>
 <artifactId>juic-mvn-plugin</artifactId>
 <version>1.0</version>
 <executions>
  <execution>
   <id>juic</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>compile</goal>
   </goals>
   <inherited>false</inherited>
   <configuration>
    <juicPath>/usr/qt/qtjambi-4.5.0/bin/juic</juicPath>
    <sourceDirectory>${basedir}/src/main2/java</sourceDirectory>
    <outputDirectory>${basedir}/target/dependency/generatedJUICFilesForApp1</outputDirectory>
    <prefix>SWUI_</prefix>
    <packageName>pl.swmud.ns.swaedit.gui</packageName>
    <all>true</true>
   </configuration>
  </execution>
 </executions>
</plugin>

The above configuration specifies different source and output than the default. Additionally it specifies a prefix for the classes that will be: SWUI_, the package name: pl.swmud.ns.swaedit.gui and forces update on all files even when there was no modification in source interface files.

Specifying more than one source directory

This configuration shows how to specify more than one source directory to have *.jui files processed even when thay are in two separate directory trees.

<plugin>
 <groupId>pl.swmud.ns.qtjambi</groupId>
 <artifactId>juic-mvn-plugin</artifactId>
 <version>1.0</version>
 <configuration>
  <juicPath>/usr/qt/qtjambi-4.5.0/bin/juic</juicPath>
 </configuration>
 <executions>
  <execution>
   <id>juic0</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>compile</goal>
   </goals>
   <inherited>false</inherited>
   <configuration>
    <sourceDirectory>${basedir}/src/main2/java</sourceDirectory>
    <prefix>SWUI_</prefix>
    <packageName>pl.swmud.ns.swaedit.gui</packageName>
    <all>true</true>
   </configuration>
  </execution>
  <execution>
   <id>juic1</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>compile</goal>
   </goals>
   <inherited>false</inherited>
   <configuration>
    <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
    <prefix>SWCoreUI_</prefix>
   </configuration>
  </execution>
 </executions>
</plugin>

First, the juicPath is moved from the execution configuration to the plugin's configuration as it is the same for both executions and don't have to be repeated. Second thing is additional execution (with different (unique) id with the respect to the previous one). The second execution is without the packageName parameter so it will be derived as derivePackageName is by default true. It has also a different prefix for the classes. One of the common values is the output directory. Execution of the configuration above will result in putting classes from two sources to one destination directory. If there is a *.jui file that has the same name in both sources, the output will be overwritten. This configuration prevents it by specifying different prefix for each sources tree.

Running the plug-in in a single thread

The configuration below shows how to run the plug-in in a single thread using classPath parameter.

<plugin>
 <groupId>pl.swmud.ns.qtjambi</groupId>
 <artifactId>juic-mvn-plugin</artifactId>
 <version>1.0</version>
 <executions>
  <execution>
   <id>juic</id>
   <phase>generate-sources</phase>
   <goals>
    <goal>compile</goal>
   </goals>
   <inherited>false</inherited>
   <configuration>
    <juicPath>/usr/qt/qtjambi-4.5.0/bin/juic</juicPath>
    <classPath>${basedir}/src/main/java</classPath>
    <prefix>SWUI_</prefix>
    <packageName>pl.swmud.ns.swaedit.gui</packageName>
   </configuration>
  </execution>
 </executions>
</plugin>

Since there is classPath parameter specified in the above configuration there will be only one thread launched and thus only one invocation of the juic program. When using classPath parameter the responsibility for finding a *.jui lies in juic program's hands. When there is no classPath parameter used, the searching for *.jui files is done by the plug-in itself.

When you use classPath, there is a possibility to exclude and include files. This includes and excludes must contain absolute path names to the files being included or excluded.

Combining configurations

The configuration presented so far are just examples. You can write your own according to your building needs, e.g. you can combine all parameters that this plug-in supports to create your own custom configuration.