11.2 Jar

This is the simplest packaging mode available. It will package the application in a single jar file, by unpacking all dependencies and packing them once more in a sole file, so place close attention to potential duplicate entries, especially those found inside META-INF.

    griffon package jar

Arguments:

- `name` - override the name of the generated jar file.

Configuration Options:

- `griffon.jars.jarName` - name of the application's main jar file.
- `griffon.dist.jar.nozip` - skip zipping the distribution if set to true.

There's a high chance of some files to have duplicates, e.g. griffon-artifacts.properties if you have installed a plugin that provides MVC groups. It's possible to instruct the build to merge duplicate files by specifying a regular expression and a merging strategy. The following table explains the different merging strategies available

Strategy | Description
--- | ---
Skip | Do not perform any merge. Duplicate is discarded.
Replace | Duplicate is preferred and overwrites previous.
Append | Duplicate is appended at the end of previous.
Merge | Common lines found in duplicate are discarded. New lines found in duplicate are appended at the end.
MergeManifest | Duplicate keys override the previous ones. New keys are added to the merged result.
MergeProperties | Duplicate keys override the previous ones. New keys are added to the merged result.
MergeGriffonArtifacts | Merges artifact definitions per type.

You can specify merging preferences in `BuildConfig.groovy` like this

    griffon {
        jars {
            merge = [
                '.*.xml': org.codehaus.griffon.ant.taskdefs.FileMergeTask.Replace
            ]
        }
    }

This setting will overwrite any XML file found in the path with the last version encountered as jars are processed. The griffon build defines a set of default mappings, which are the ones found in the next table

Regexp | MergeStrategy
--- | ---
META-INF/griffon-artifacts.properties | MergeGriffonArtifacts
META-INF/MANIFEST.MF | MergeManifest
META-INF/services/.* | Merge
.*.properties | MergeProperties

Merging preferences must be defined from the most specific to the least. Your preferences will override any default settings.