1# Building
2ZAP is built with [Gradle], the following sections explain how to use it to build and run ZAP.
3The Gradle tasks are expected to be executed with the provided [Gradle Wrapper].
4
5## IDEs
6The following page provides in depth guides on how to import, build, and run ZAP (core and add-ons) with commonly used IDEs:
7https://www.zaproxy.org/docs/developer/
8
9## Run ZAP
10To run ZAP directly from the source run the task `:zap:run`. It will use any add-ons available in the [zap/src/main/dist/plugin/] directory.
11
12**NOTE:** No add-on is included in the repository, they need to be built/copied separately into the `plugin` directory.
13
14### Tests
15To execute the tests run the task `:zap:test`.
16
17## Distributions
18The distributions bundle ZAP and its dependencies, all necessary to run ZAP standalone. By default the distributions of development
19versions (SNAPSHOT) bundle the add-ons present in the dist `plugin` directory, main versions (non-SNAPSHOT) bundle a [predefined
20list of add-ons] (downloaded automatically when the distribution is built).
21
22The distributions are built into `zap/build/distributions/`.
23
24### Daily
25A zip package with a day stamped version, does not target any specific OS, it bundles all add-ons present in the `plugin` directory always.
26
27To build it run the task `:zap:distDaily`.
28
29(This distribution is built by default, it is a dependency of `assemble` task.)
30
31### Weekly
32A zip package with a day stamped version, does not target any specific OS, it bundles only [weekly add-ons] (built automatically from
33source when the distribution is built).
34This distribution is used for weekly releases.
35
36To build it run the task `:zap:distWeekly`.
37
38The build also provides the task `:zap:copyWeeklyAddOns` which builds and copies the weekly add-ons into the plugin directory,
39using existing repositories in the file system at the same level as zaproxy.
40
41### Cross Platform
42A zip package, does not target any specific OS.
43
44To build it run the task `:zap:distCrossplatform`.
45
46### Core
47Same as cross platform distribution but with just the essential add-ons, making the distribution smaller.
48
49To build it run the task `:zap:distCore`.
50
51### Linux
52A tar.gz package, the macOS/Windows specific add-ons are excluded from this distribution.
53
54To build it run the task `:zap:distLinux`.
55
56#### Debian
57A deb package, bundling ZAP and its dependencies. Does not bundle any add-ons, they are expected to be installed separately, for example, from marketplace.
58
59To build it run the task `:zap:distDebian`.
60
61### macOS
62A dmg bundling ZAP, its dependencies, and JRE. The Linux/Windows specific add-ons are excluded from this distribution.
63
64To build it run the task `:zap:distMac`.
65
66**NOTE:** Needs to be executed on macOS, it requires `hdiutils`.
67
68## Installers
69The installers for Linux and Windows are built with [install4j]. The Windows executable is built with the [launch4j], invoked with Gradle plugin [gradle-launch4j].
70
71To build the installers run the task `:zap:installers`.
72
73Once the build is finished the installers will be located in the directory `zap/build/install4j/`.
74
75**NOTE:** The following properties must be defined (e.g. in file `GRADLE_HOME/gradle.properties` ) to successfully and properly build the installers:
76 - `install4jHomeDir` - install4j installation directory;
77 - `install4jLicense` - install4j license key.
78
79[Gradle]: https://gradle.org/
80[Gradle Wrapper]: https://docs.gradle.org/current/userguide/gradle_wrapper.html
81[zap/src/main/dist/plugin/]: zap/src/main/dist/plugin/
82[predefined list of add-ons]: zap/src/main/add-ons.txt
83[weekly add-ons]: zap/src/main/weekly-add-ons.json
84[install4j]: https://www.ej-technologies.com/products/install4j/overview.html
85[launch4j]: http://launch4j.sourceforge.net/
86[gradle-launch4j]: https://github.com/TheBoegl/gradle-launch4j
87