## Synopsis
`ceylon war [--cacherep=<url>] [--cwd=<dir>] [--exclude-module=<moduleOrFile>...] [--jdk-provider=<module>] [--link-with-current-distribution] [--maven-overrides=<file>] [--name=<name>] [--no-default-repositories] [--offline] [--out=<dir>] [--overrides=<file>] [--provided-module=<moduleOrFile>...] [--rep=<url>...] [--resource-root=<directory>] [--static-metamodel] [--sysrep=<url>] [--timeout=<seconds>] [--verbose[=<flags>]] [--] <module-with-version>`

## Description
Generates a WAR file from the `.car` file of the given `module-with-version`, suitable for deploying to a standard Servlet container. The version number is required since, in general, there can be multiple versions available in the configured repositories. The given module's `.car` file and those of its transitive dependencies will be copied to the `WEB-INF/lib` of the generated WAR file. Dependencies which are provided by the application container (and thus not required to be in `WEB-INF/lib`) can be excluded using `--provided-module`.

## Options
`--cacherep=url` | Specifies the folder to use for caching downloaded modules. (default: `~/.ceylon/cache`)
`--cwd=dir` | Specifies the current working directory for this tool. (default: the directory where the tool is run from)
`--exclude-module=moduleOrFile`, `-x moduleOrFile` | Excludes modules from the WAR file. Can be a module name or a file containing module names. Can be specified multiple times. Note that this excludes the module from the WAR file, but if your modules require that module to be present at runtime it will still be required and may cause your application to fail to start if it is not provided at runtime.
`--jdk-provider=module` | Alternate JDK provider module (defaults to the current running JDK).
`--link-with-current-distribution` | Downgrade which were compiled with a more recent version of the distribution to the version of that module present in this distribution (1.3.1). This might fail with a linker error at runtime. For example if the module depended on an API present in the more recent version, but absent from 1.3.1. Allowed arguments are upgrade, downgrade or abort. Default: upgrade
`--maven-overrides=file` | Specifies the XML file to use to load Maven artifact overrides. See http://ceylon-lang.org/documentation/current/reference/repository/maven/ for information. Deprecated: use --overrides.
`--name=name`, `-n name` | Sets name of the WAR file (default: moduleName-version.war)
`--no-default-repositories` | Indicates that the default repositories should not be used.
`--offline`, `-L` | Enables offline mode that will prevent connections to remote repositories.
`--out=dir`, `-o dir` | Sets the output directory for the WAR file (default: .)
`--overrides=file` | Specifies the XML file to use to load module overrides. See http://ceylon-lang.org/documentation/current/reference/repository/maven/ for information. Experimental.
`--provided-module=moduleOrFile`, `-p moduleOrFile` | Excludes modules from the WAR file by treating them as provided. Can be a module name or a file containing module names. Can be specified multiple times. Note that this excludes the module from the WAR file, but if your modules require that module to be present at runtime it will still be required and may cause your application to fail to start if it is not provided at runtime. The only difference between this and `--exclude-module` is that provided modules are listed in the metamodel.
`--rep=url` | Specifies a module repository containing dependencies. Can be specified multiple times. (default: `modules`, `~/.ceylon/repo`, `https://modules.ceylon-lang.org/repo/1`)
`--resource-root=directory`, `-R directory` | Sets the special resource directory whose files will end up in the root of the resulting WAR file (default: web-content).
`--static-metamodel` | Generate a static metamodel, skip the WarInitializer (default: false).
`--sysrep=url` | Specifies the system repository containing essential modules. (default: `$CEYLON_HOME/repo`)
`--timeout=seconds`, `-T seconds` | Sets the timeout for connections to remote repositories, use 0 for no timeout (default: 20).
`--verbose[=flags]`, `-d` | Produce verbose output. If no `flags` are given then be verbose about everything, otherwise just be verbose about the flags which are present. Allowed flags include: `all`, `loader`.

## Static metamodel or WarInitializer
Ceylon can set up the run-time metamodel using either a listener (ceylon.war.WarInitializer) that is set in the default web.xml. Or by generating a static metamodel file.

## Static metamodel
If you want to run on WildFly or other application servers that remove provided jars from the `lib/` folder, you should try the `--static-metamodel` argument and marking your provided modules with `--provided-module`.

## WarInitializer
On non-WildFly application servers you should leave `ceylon war` do the default of generating a `web.xml` file for you which will call the `WarInitializer` listener to set up the metamodel based on the contents of the `lib/` folder at run-time. ### Overriding web.xml If you provide a custom `WEB-INF/web.xml` file in your WAR resource-root, you'll need to include the listener (ceylon.war.WarInitializer) that is set in the default web.xml. Without that listener, the metamodel will not be properly initialized.

## Repositories
Repositories like those specified with the `--rep` or `--out` options can be file paths, HTTP urls to remote servers or can be names of repositories when prepended with a `+` symbol. These names refer to repositories defined in the configuration file or can be any of the following predefined names `+SYSTEM`, `+CACHE`, `+LOCAL`, `+USER`, `+REMOTE` or `+MAVEN`. For more information see https://ceylon-lang.org/documentation/1.3/reference/repository/tools