Project Information
Savant build files must be placed at the root of the project and they should be named build.savant. Build files will define the project information, dependencies, workflow, and targets.
Let’s start out by looking at a simple Savant build file that defines a project. Edit the file build.savant in your IDE or favorite text editor. Put this in your build file.
project(group: "org.example", name: "my-project", version: "1.0", licenses: ["Apache-2.0"]) {
// More info here
}
You define your project details using the project method. This method takes a block, that allows you to define additional details about your project like dependencies. The key here is that the project requires these attributes:
- group - The group identifier for your organization (usually a reverse domain name)
- name - The name of the project
- version - A semantic version https://semver.org
- licenses - The license(s) of your project
One of the most important details is that Savant requires that everything uses Semantic Versions. This is vitally important when Savant calculates dependencies of your project. You should read the Semantic Version specification by visiting https://semver.org.
You also need to specify one or more licenses for your project. All projects must specify at least one license. This helps Savant determine if your project is in compliance with organizational requirements about software licensing.
Savant uses SPDX license identifiers for all licenses. Any valid SPDX license ID can be used. Here are some commonly used examples:
Apache-2.0- Apache License 2.0MIT- MIT LicenseBSD-2-Clause- BSD 2-Clause “Simplified” LicenseBSD-3-Clause- BSD 3-Clause “New” or “Revised” LicenseGPL-2.0-only- GNU General Public License v2.0 onlyGPL-3.0-only- GNU General Public License v3.0 onlyLGPL-2.1-only- GNU Lesser General Public License v2.1 onlyLGPL-3.0-only- GNU Lesser General Public License v3.0 onlyEPL-1.0- Eclipse Public License 1.0EPL-2.0- Eclipse Public License 2.0MPL-2.0- Mozilla Public License 2.0CDDL-1.0- Common Development and Distribution License 1.0
SPDX license exceptions are also supported using the WITH keyword. For example, GPL-2.0-only WITH Classpath-exception-2.0.
In addition to SPDX identifiers, Savant supports these custom license types:
Commercial- Commercial licenseOther- Other licenseOtherDistributableOpenSource- Other open source license that allows the code to be freely distributedOtherNonDistributableOpenSource- Other open source license that doesn’t allow the code to be freely distributed
Custom license types require that the project supply their own license text file at the root of the project. The file must follow this naming convention:
license-<type>.txt
So, if your project is using a Commercial license, you need to create a file named: license-Commercial.txt at the root of your project.