Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: duplicateStrategy

[46:6] static extends: object

Enum defines how a jar build handles an entry that appears in more than one input. first keeps the first seen, last the last, and error fails the build on a conflict.

Members

  • first
  • last
  • error

class: docVisibility

[68:6] static extends: object

Enum defines the Javadoc visibility levels. protectedApi is Javadoc's own default (public and protected members); publicApi narrows to public only, and packageApi / privateApi widen to include more.

Members

  • publicApi
  • protectedApi
  • packageApi
  • privateApi

class: JavaJar

[330:7] extends: object

JavaJar carries the full set of packaging inputs for JavaTools.jar. The simple jar call covers a library jar and an executable jar. The thin, uber, and shaded kinds add enough options - bundled jars, duplicate handling, relocation, manifest headers, filters - that a flat argument list would be unwieldy, so they live here.

Members

  • inputDirsValue
  • outputValue
  • mainClassValue
  • manifestValue
  • classpathValue
  • includesValue
  • excludesValue
  • bundleValue
  • duplicatesValue
  • mergeServicesValue
  • stripSignaturesValue
  • relocationsValue

Methods

  • inputDir (InputDir)

    Sets the directory holding the class files and resources to package.

    • @p InputDir is a directory path, or a list of directories to merge.
    • @r this object for chaining.
  • output (string Output)

    Sets the jar path to write.

    • @p Output is the output jar path.
    • @r this object for chaining.
  • mainClass (string MainClass)

    Sets the Main-Class manifest header, which makes the jar executable.

    • @p MainClass is the fully qualified main class name.
    • @r this object for chaining.
  • manifest (map Manifest)

    Sets extra manifest headers.

    • @p Manifest is a map of header name to value.
    • @r this object for chaining.
  • classpath (list Classpath)

    Sets the jars written as a Class-Path header, producing a thin jar that points at external jars rather than bundling them.

    • @p Classpath is a list of jar paths.
    • @r this object for chaining.
  • includes (list Includes)

    Sets glob patterns selecting which entries to include. When unset every entry is included.

    • @p Includes is a list of glob patterns.
    • @r this object for chaining.
  • excludes (list Excludes)

    Sets glob patterns selecting which entries to drop, for example to strip a module-info.class.

    • @p Excludes is a list of glob patterns.
    • @r this object for chaining.
  • bundle (list Bundle)

    Sets dependency jars whose entries are inlined, producing a self-contained uber jar.

    • @p Bundle is a list of jar paths.
    • @r this object for chaining.
  • duplicates (string Strategy)

    Sets how an entry appearing in more than one input is handled.

    • @p Strategy is the strategy string. (enum duplicateStrategy)
    • @r this object for chaining.
  • mergeServices (bool Merge)

    Sets whether META-INF/services/* files from bundled jars are concatenated rather than overwritten. True by default, so service-provider entries from every bundled jar survive.

    • @p Merge is true to concatenate service files.
    • @r this object for chaining.
  • stripSignatures (bool Strip)

    Sets whether signature files from bundled jars are dropped. True by default, since they no longer match the merged archive and would fail verification.

    • @p Strip is true to drop signature files.
    • @r this object for chaining.
  • relocate (string From, string To)

    Adds a package-prefix rename rule; call it again for more rules. Every reference to the From package - in class bytecode, resource paths, and service files - is rewritten to To. Relocation turns an uber jar into a shaded jar, letting an application bundle its own copy of a library without colliding with a different version elsewhere on the classpath.

    • @p From is the package prefix to rename.
    • @p To is the replacement package prefix.
    • @r this object for chaining.
  • toMap ()

    Converts this options object to the map the backing implementation reads. Called by JavaTools.jar.

    • @r A map with the jar inputs.

class: packageType

[81:6] static extends: object

Enum defines the jpackage output kinds. Each member maps to jpackage's own --type value; only appImage differs from the tool's spelling (app-image). appImage produces a native app image directory; the rest produce platform installers and need that platform's tooling.

Members

  • appImage
  • exe
  • msi
  • dmg
  • pkg
  • deb
  • rpm

class: JavaPackage

[817:7] extends: object

JavaPackage carries the full set of inputs for JavaTools.jpackage. jpackage turns an application plus a runtime into a native app image or a platform installer. The simple jpackage call covers the common case (type, name, input directory, main jar and class); this options object adds the metadata, runtime, and platform controls.

Members

  • typeValue
  • nameValue
  • inputDirValue
  • mainJarValue
  • mainClassValue
  • appVersionValue
  • destValue
  • vendorValue
  • descriptionValue
  • copyrightValue
  • iconValue
  • runtimeImageValue
  • javaOptionsValue
  • addLaunchersValue
  • fileAssociationsValue
  • linuxShortcutValue
  • winConsoleValue
  • winShortcutValue
  • winMenuValue
  • macPackageIdentifierValue
  • macPackageNameValue
  • argsValue

Methods

  • type (string Type)

    Sets the output kind (jpackage --type).

    • @p Type is the type string. (enum packageType)
    • @r this object for chaining.
  • name (string Name)

    Sets the application name (jpackage --name).

    • @p Name is the application name.
    • @r this object for chaining.
  • inputDir (string InputDir)

    Sets the input directory holding the application jars (jpackage --input).

    • @p InputDir is the input directory path.
    • @r this object for chaining.
  • mainJar (string MainJar)

    Sets the launched jar (jpackage --main-jar), relative to the input directory.

    • @p MainJar is the main jar file name.
    • @r this object for chaining.
  • mainClass (string MainClass)

    Sets the application main class (jpackage --main-class).

    • @p MainClass is the fully qualified main class name.
    • @r this object for chaining.
  • appVersion (string Version)

    Sets the application version (jpackage --app-version).

    • @p Version is the version string.
    • @r this object for chaining.
  • dest (string Dest)

    Sets the output directory (jpackage --dest). Defaults to "build/jpackage" when unset.

    • @p Dest is the output directory path.
    • @r this object for chaining.
  • vendor (string Vendor)

    Sets the vendor (jpackage --vendor).

    • @p Vendor is the vendor name.
    • @r this object for chaining.
  • description (string Description)

    Sets the description (jpackage --description).

    • @p Description is the description text.
    • @r this object for chaining.
  • copyright (string Copyright)

    Sets the copyright (jpackage --copyright).

    • @p Copyright is the copyright text.
    • @r this object for chaining.
  • icon (string Icon)

    Sets the application icon (jpackage --icon).

    • @p Icon is the icon file path.
    • @r this object for chaining.
  • runtimeImage (string RuntimeImage)

    Sets the runtime image (jpackage --runtime-image). When unset, jpackage reuses the selected JDK's runtime rather than running its own internal jlink. Pass a jlink output for a slimmer runtime.

    • @p RuntimeImage is the runtime image directory path.
    • @r this object for chaining.
  • javaOption (string Option)

    Adds a JVM option for the launched application (jpackage --java-options). Call it again for more.

    • @p Option is the JVM option to pass.
    • @r this object for chaining.
  • addLauncher (string Name, string PropsPath)

    Adds an extra launcher (jpackage --add-launcher). Call it again for more.

    • @p Name is the launcher name.
    • @p PropsPath is the path to the launcher's properties file.
    • @r this object for chaining.
  • fileAssociation (string PropsPath)

    Adds a file-association properties file (jpackage --file-associations). Call it again for more.

    • @p PropsPath is the path to the association's properties file.
    • @r this object for chaining.
  • linuxShortcut (bool Shortcut)

    Sets whether to add a Linux shortcut (jpackage --linux-shortcut).

    • @p Shortcut is true to add a shortcut.
    • @r this object for chaining.
  • winConsole (bool Console)

    Sets whether to launch with a console on Windows (jpackage --win-console).

    • @p Console is true to launch with a console.
    • @r this object for chaining.
  • winShortcut (bool Shortcut)

    Sets whether to add a Windows shortcut (jpackage --win-shortcut).

    • @p Shortcut is true to add a shortcut.
    • @r this object for chaining.
  • winMenu (bool Menu)

    Sets whether to add a Windows Start menu entry (jpackage --win-menu).

    • @p Menu is true to add a menu entry.
    • @r this object for chaining.
  • macPackageIdentifier (string Identifier)

    Sets the macOS package identifier (jpackage --mac-package-identifier).

    • @p Identifier is the package identifier.
    • @r this object for chaining.
  • macPackageName (string Name)

    Sets the macOS package name (jpackage --mac-package-name).

    • @p Name is the package name.
    • @r this object for chaining.
  • arg (string Arg)

    Adds a raw jpackage flag. The escape hatch for any flag not modeled.

    • @p Arg is the flag to pass through.
    • @r this object for chaining.
  • toMap ()

    Converts this options object to the map the backing implementation reads. Called by JavaTools.jpackage.

    • @r A map with the jpackage inputs.

class: procMode

[23:6] static extends: object

Enum defines the annotation processing modes for a compile. full compiles and processes, only processes without compiling, and none compiles with no processing.

Members

  • full
  • only
  • none

class: jdkSource

[10:6] static extends: object

Enum defines where a discovered JDK was found. Each member evaluates to its own name as a string, so it can be compared directly against the source field of a detectJdks entry.

Members

  • shipped
  • javaHome
  • path
  • versionManager
  • wellKnown

class: JavaDoc

[513:7] extends: object

JavaDoc carries the full set of documentation inputs for JavaTools.javadoc, for callers who need more than the inline form's sources, output directory, and classpath.

Members

  • sourcesValue
  • outputDirValue
  • classpathValue
  • modulePathValue
  • windowTitleValue
  • docTitleValue
  • linkValue
  • docletValue
  • visibilityValue
  • argsValue
  • jdkValue

Methods

  • sources (list Sources)

    Sets the source files or directories to document.

    • @p Sources is a list of paths.
    • @r this object for chaining.
  • outputDir (string OutputDir)

    Sets the HTML output directory.

    • @p OutputDir is the output directory path.
    • @r this object for chaining.
  • classpath (list Classpath)

    Sets the classpath, letting Javadoc resolve types the code refers to.

    • @p Classpath is a list of jars and directories.
    • @r this object for chaining.
  • modulePath (list ModulePath)

    Sets the module path. A modular project - one with a module-info.java - needs its dependencies here so Javadoc can resolve the module's requires, the same way javac does.

    • @p ModulePath is a list of jars and directories.
    • @r this object for chaining.
  • windowTitle (string Title)

    Sets the browser window title.

    • @p Title is the window title text.
    • @r this object for chaining.
  • docTitle (string Title)

    Sets the documentation overview title.

    • @p Title is the doc title text.
    • @r this object for chaining.
  • link (string Url)

    Adds a -link cross-reference to another API's documentation; call it again for more.

    • @p Url is the documentation URL to link against.
    • @r this object for chaining.
  • doclet (string Doclet)

    Sets a custom doclet class.

    • @p Doclet is the doclet class name.
    • @r this object for chaining.
  • visibility (string Visibility)

    Sets which members are documented.

    • @p Visibility is the visibility string. (enum docVisibility)
    • @r this object for chaining.
  • arg (string Arg)

    Adds a raw javadoc flag. This is the escape hatch for any flag not modeled by a setter.

    • @p Arg is the flag to pass through.
    • @r this object for chaining.
  • jdk (string Jdk)

    Overrides the configured JDK for this run only.

    • @p Jdk is the JDK home path.
    • @r this object for chaining.
  • toMap ()

    Converts this options object to the map the backing implementation reads. Called by JavaTools.javadoc.

    • @r A map with the javadoc inputs.

class: JavaTools

[1125:14] (extern: com.lehman.aussom.stdlib.AussomJavaTools) extends: object

JavaTools lets Aussom code compile Java source, package class files into a jar of any kind, generate Javadoc, and resolve Maven dependencies. It is an instantiable object rather than a static class because a caller usually sets configuration once - which JDK, which Maven repositories, where the local repository lives - and then runs several operations against it. By default it uses the system JDK - the one the developer's own shell compiles with (JAVA_HOME, else javac on the PATH) - so a build script uses the JDK the user expects rather than Aussom's bundled runtime. It falls back to the JDK that ships with Aussom when no system JDK is found. A system or specific JDK runs that JDK's tools as a subprocess, while the shipped JDK compiles in-process (with structured diagnostics), because the in-process compiler is always the running JVM's own.

Methods

  • JavaTools ()

    Constructor creates a new JavaTools object configured with the system JDK (falling back to the shipped JDK) and Maven Central.

  • newJavaTools ()

  • useShippedJdk ()

    Selects the JDK that ships with Aussom, the fallback default. It compiles in-process and yields structured diagnostics.

    • @r This object.
  • useSystemJdk ()

    Selects the system JDK: JAVA_HOME when set, otherwise javac on the PATH. Compiles as a subprocess against that JDK.

    • @r This object.
  • useJdk (string JdkHome)

    Selects a specific JDK by home path. Compiles as a subprocess against that JDK.

    • @p JdkHome is the JDK home directory, meaning the directory that contains bin/javac.
    • @r This object.
  • useSubprocess (bool Force = true)

    Forces the subprocess path even for the shipped JDK, for callers who want the isolation of a separate process.

    • @p Force is true to always run tools as a subprocess.
    • @r This object.
  • getJdkHome ()

    Gets the currently selected JDK home.

    • @r A string with the JDK home path.
  • setLocalRepo (string Path)

    Sets the Maven local repository directory. When unset, resolution falls back to the detected one, so it uses the caller's existing ~/.m2 cache by default.

    • @p Path is the local repository path.
    • @r This object.
  • addRepo (string Id, string Url)

    Adds a remote Maven repository. Call it again for more.

    • @p Id is the repository id, such as "central".
    • @p Url is the repository base URL.
    • @r This object.
  • clearRepos ()

    Clears the configured remote repositories, including the default Maven Central entry. Lets a caller resolve from only their own repositories.

    • @r This object.
  • detectJdks ()

    Discovers every installed JDK found on this machine, newest first. Discovery is best effort and never fails the build; it returns what it can find, and the explicit setters remain the reliable fallback for anything it misses.

    • @r A list of maps, each with home, version, vendor, hasCompiler, and source. (enum jdkSource)
  • detectLocalRepo ()

    Finds the Maven local repository the way Maven itself resolves it: the maven.repo.local system property, then a localRepository element in ~/.m2/settings.xml, then the default <user.home>/.m2/repository. The default is returned even when the directory does not exist yet, since a resolve will create it.

    • @r A string with the local repository path.
  • useDetectedJdk ()

    Picks a discovered JDK and configures it in one step. Prefers JAVA_HOME when that is a valid JDK, otherwise the newest discovered version that has a compiler, and always falls back to the shipped JDK when discovery comes up empty.

    • @r A map describing the JDK it chose.
  • compile (Sources, string OutputDir = "build/classes", list Classpath = null, int Release = null)

    Compiles Java source to class files. The everyday case is a short call: jt.compile(["src"]) compiles everything under src to build/classes at the JDK's own release. For the longer tail of javac inputs, pass a JavaCompile options object as the only argument instead.

    • @p Sources is a list of .java files or directories, or a JavaCompile options object carrying the full input set.
    • @p OutputDir is where class files are written. Defaults to "build/classes". Ignored when Sources is a JavaCompile.
    • @p Classpath is a list of jars and directories for the compile classpath; a classpath from resolve drops straight in. Ignored when Sources is a JavaCompile.
    • @p Release is the Java feature release. Defaults to null, meaning match the selected JDK. Ignored when Sources is a JavaCompile.
    • @r A map with success and diagnostics, each diagnostic carrying kind (enum diagnosticKind), file, line, column, and message. A subprocess compile also carries exitCode, stdout, and stderr.
  • compileEx (map Spec)

  • javadoc (Sources, string OutputDir = "build/docs", list Classpath = null)

    Generates HTML API documentation from source. Packaging the docs is then just a jar over the output, which matches the Maven -javadoc and -sources artifact convention.

    • @p Sources is a list of .java files or directories, or a JavaDoc options object carrying the full input set.
    • @p OutputDir is the HTML output directory. Defaults to "build/docs". Ignored when Sources is a JavaDoc.
    • @p Classpath is a list of jars and directories letting Javadoc resolve types the code refers to. Ignored when Sources is a JavaDoc.
    • @r A map with success and the diagnostics the tool produced.
  • javadocEx (map Spec)

  • jar (InputDir, string Output = null, string MainClass = null)

    Packages class files into a jar. A library jar needs only the input tree and the output path; adding a main class makes it executable. For the thin, uber, and shaded kinds, pass a JavaJar options object as the only argument instead.

    • @p InputDir is a directory string, a list of directories to merge, or a JavaJar options object carrying the full input set.
    • @p Output is the jar path to write. Ignored when InputDir is a JavaJar.
    • @p MainClass is the Main-Class header, which makes the jar executable. Defaults to null. Ignored when InputDir is a JavaJar.
    • @r A map with success, jarPath, entryCount, jarsBundled, and relocationsApplied.
  • jarEx (map Spec)

  • jarList (string JarPath)

    Gets the entry names in a jar.

    • @p JarPath is the jar to read.
    • @r A list of strings with the entry names.
  • jarEntries (string JarPath)

    Gets per-entry detail for a jar, for inspecting an archive without unpacking it.

    • @p JarPath is the jar to read.
    • @r A list of maps, each with name, size, compressedSize, isDirectory, and time.
  • jarRead (string JarPath, string EntryName)

    Reads a single entry's contents out of a jar without extracting the whole thing.

    • @p JarPath is the jar to read.
    • @p EntryName is the entry to read.
    • @r A Buffer object with the entry's bytes.
  • jarManifest (string JarPath)

    Gets a jar's manifest headers.

    • @p JarPath is the jar to read.
    • @r A map of manifest header name to value.
  • jarExtract (string JarPath, string DestDir, list Globs = null)

    Unpacks a jar's entries into a directory.

    • @p JarPath is the jar to unpack.
    • @p DestDir is the directory to write into.
    • @p Globs is an optional list of glob patterns limiting what is written. Defaults to null, meaning every entry.
    • @r An int with the number of entries written.
  • jarPut (string JarPath, string EntryName, Data)

    Adds an entry to a jar, or replaces it when the name already exists. Keeps META-INF/MANIFEST.MF first and leaves the manifest intact.

    • @p JarPath is the jar to edit.
    • @p EntryName is the entry to add or replace.
    • @p Data is a string or Buffer object with the entry's contents.
    • @r true on success.
  • jarReplace (string JarPath, string EntryName, Data)

    Replaces an existing entry in a jar. Same as jarPut but fails when the entry is absent, for callers who want that check.

    • @p JarPath is the jar to edit.
    • @p EntryName is the entry to replace.
    • @p Data is a string or Buffer object with the entry's contents.
    • @r true on success.
  • jarPutEx (string JarPath, string EntryName, Data, bool MustExist)

  • jarRemove (string JarPath, string EntryName)

    Removes an entry from a jar.

    • @p JarPath is the jar to edit.
    • @p EntryName is the entry to drop.
    • @r true on success.
  • resolve (Coordinates, string Scope = "compile", bool Transitive = true)

    Resolves a Maven artifact and its transitive dependencies and returns the local jar paths - the classpath a compile or a jar step needs. The remote repositories and local cache are set once on the object with addRepo and setLocalRepo, so this call stays short.

    • @p Coordinates is a single "group:artifact:version" string, or a list of them.
    • @p Scope is which transitive dependencies to include. Defaults to "compile". (enum resolveScope)
    • @p Transitive is true by default; false resolves only the named artifacts.
    • @r A map with success, classpath (the resolved jar paths), and artifacts (each with coordinate and path).
  • jlink (Modules, string Output = null, list ModulePath = null)

    Builds a custom Java runtime image with jlink, holding only the modules an application needs. The everyday case is a short call with the root modules and an output directory. For the fuller set, pass a JavaLink options object as the only argument instead.

    • @p Modules is a list of root module names, or a JavaLink options object carrying the full input set.
    • @p Output is the image directory to write; it must not already exist. Ignored when Modules is a JavaLink.
    • @p ModulePath is a list of module jars and directories for non-JDK modules. Ignored when Modules is a JavaLink.
    • @r A map with success, imagePath, exitCode, stdout, and stderr.
  • jlinkEx (map Spec)

  • jpackage (Type, string Name = null, string InputDir = null, string MainJar = null, string MainClass = null)

    Builds a native app image or platform installer with jpackage. The everyday case is a short call with the type, name, input directory, main jar, and main class. For the fuller set, pass a JavaPackage options object as the only argument instead. By default jpackage reuses the selected JDK's runtime rather than running its own internal jlink.

    • @p Type is the output kind (enum packageType), or a JavaPackage options object carrying the full input set.
    • @p Name is the application name. Ignored when Type is a JavaPackage.
    • @p InputDir is the directory holding the application jars (--input). Ignored when Type is a JavaPackage.
    • @p MainJar is the launched jar (--main-jar). Ignored when Type is a JavaPackage.
    • @p MainClass is the main class (--main-class). Defaults to null. Ignored when Type is a JavaPackage.
    • @r A map with success, packagePath, exitCode, stdout, and stderr.
  • jpackageEx (map Spec)

  • install (string Group, string Artifact, string Version, string JarPath, string PomPath = null, string SourcesPath = null, string JavadocPath = null)

    Installs a built jar and its companion artifacts into the local Maven repository, so other projects on the same machine can resolve it as a dependency. The POM, sources jar, and javadoc jar are optional; pass null to skip one. The install always runs; it does not skip when the same version is already present, so re-installing a version needs no bump and no manual delete from the repository.

    • @p Group is the Maven groupId.
    • @p Artifact is the Maven artifactId.
    • @p Version is the Maven version.
    • @p JarPath is the main jar to install.
    • @p PomPath is the POM file to install, or null.
    • @p SourcesPath is the sources jar to install, or null.
    • @p JavadocPath is the javadoc jar to install, or null.
    • @r A map with success and, on failure, a message.

class: resolveScope

[57:6] static extends: object

Enum defines which transitive dependencies a resolve includes. compile is the set needed to compile against the artifact and runtime is the set needed to run it.

Members

  • compile
  • runtime

class: linkCompress

[96:6] static extends: object

Enum defines the jlink compression level, mapping each member to jlink's --compress value: zip0 is no compression through zip9 for the best compression. jlink's own default is zip6 when unset.

Members

  • zip0
  • zip1
  • zip2
  • zip3
  • zip4
  • zip5
  • zip6
  • zip7
  • zip8
  • zip9

class: JavaLink

[671:7] extends: object

JavaLink carries the full set of inputs for JavaTools.jlink. jlink builds a minimal Java runtime holding only the modules an application needs. The simple jlink call covers the common case (root modules and an output directory); this options object adds the size and launcher controls.

Members

  • modulesValue
  • outputValue
  • modulePathValue
  • stripDebugValue
  • noHeaderFilesValue
  • noManPagesValue
  • bindServicesValue
  • compressValue
  • launchersValue
  • argsValue

Methods

  • modules (list Modules)

    Sets the root modules to include (jlink --add-modules).

    • @p Modules is a list of module names.
    • @r this object for chaining.
  • output (string Output)

    Sets the image output directory (jlink --output). It must not already exist.

    • @p Output is the image directory path.
    • @r this object for chaining.
  • modulePath (list ModulePath)

    Sets the module path for non-JDK modules (jlink --module-path). A classpath from resolve of modular jars drops in here.

    • @p ModulePath is a list of module jars and directories.
    • @r this object for chaining.
  • stripDebug (bool Strip)

    Sets whether to strip debug information (jlink --strip-debug).

    • @p Strip is true to strip debug info.
    • @r this object for chaining.
  • noHeaderFiles (bool NoHeaders)

    Sets whether to omit header files (jlink --no-header-files).

    • @p NoHeaders is true to omit header files.
    • @r this object for chaining.
  • noManPages (bool NoMan)

    Sets whether to omit man pages (jlink --no-man-pages).

    • @p NoMan is true to omit man pages.
    • @r this object for chaining.
  • bindServices (bool Bind)

    Sets whether to bind service providers (jlink --bind-services), so ServiceLoader users like java.logging are included.

    • @p Bind is true to bind services.
    • @r this object for chaining.
  • compress (string Compress)

    Sets the compression level (jlink --compress).

    • @p Compress is the level string. (enum linkCompress)
    • @r this object for chaining.
  • launcher (string Name, string Module)

    Adds a launcher script to the image (jlink --launcher). Call it again for more launchers.

    • @p Name is the launcher command name.
    • @p Module is the module (or module/mainclass) to launch.
    • @r this object for chaining.
  • arg (string Arg)

    Adds a raw jlink flag. The escape hatch for any flag not modeled.

    • @p Arg is the flag to pass through.
    • @r this object for chaining.
  • toMap ()

    Converts this options object to the map the backing implementation reads. Called by JavaTools.jlink.

    • @r A map with the jlink inputs.

class: diagnosticKind

[33:6] static extends: object

Enum defines the compiler diagnostic kinds. The values match the Java compiler's own Diagnostic.Kind names.

Members

  • ERROR
  • WARNING
  • MANDATORY_WARNING
  • NOTE
  • OTHER

class: JavaCompile

[120:7] extends: object

JavaCompile carries the full set of compilation inputs for JavaTools.compile. Aussom arguments are positional, so compile takes only the everyday knobs directly. The longer tail of javac inputs - annotation processing, modular builds, encoding, extra flags, a per-call JDK override - would make an unwieldy argument list, so they live here. Every setter is typed and optional; an unset one keeps the same default as the inline form.

Members

  • sourcesValue
  • outputDirValue
  • classpathValue
  • releaseValue
  • encodingValue
  • processorPathValue
  • processorsValue
  • procValue
  • modulePathValue
  • addModulesValue
  • addExportsValue
  • addReadsValue
  • patchModuleValue
  • argsValue
  • jdkValue

Methods

  • sources (list Sources)

    Sets the source files or directories to compile. Directories are walked for .java files.

    • @p Sources is a list of paths.
    • @r this object for chaining.
  • outputDir (string OutputDir)

    Sets where class files are written (javac -d).

    • @p OutputDir is the output directory path.
    • @r this object for chaining.
  • classpath (list Classpath)

    Sets the compile classpath. A classpath from resolve drops straight in.

    • @p Classpath is a list of jars and directories.
    • @r this object for chaining.
  • release (int Release)

    Sets the Java feature release (javac --release N). When unset the build matches the selected JDK's own release.

    • @p Release is the feature release number.
    • @r this object for chaining.
  • encoding (string Encoding)

    Sets the source file encoding.

    • @p Encoding is the encoding name, such as "UTF-8".
    • @r this object for chaining.
  • processorPath (list ProcessorPath)

    Sets the annotation processor path. An annotation processor is a plugin javac runs during compilation to read annotations and generate more source or classes.

    • @p ProcessorPath is a list of jars holding processors.
    • @r this object for chaining.
  • processors (list Processors)

    Names which annotation processors to run.

    • @p Processors is a list of processor class names.
    • @r this object for chaining.
  • proc (string Proc)

    Sets the annotation processing mode.

    • @p Proc is the mode string. (enum procMode)
    • @r this object for chaining.
  • modulePath (list ModulePath)

    Sets the JPMS module path. A project with a module-info.java compiles against the module path rather than the classpath.

    • @p ModulePath is a list of module jars and directories.
    • @r this object for chaining.
  • addModules (list AddModules)

    Adds root modules to resolve (javac --add-modules).

    • @p AddModules is a list of module names.
    • @r this object for chaining.
  • addExports (string Export)

    Adds a module export (javac --add-exports).

    • @p Export is an export spec such as "java.base/jdk.internal.module=ALL-UNNAMED".
    • @r this object for chaining.
  • addReads (string Read)

    Adds a module read edge (javac --add-reads).

    • @p Read is a read spec such as "mymod=ALL-UNNAMED".
    • @r this object for chaining.
  • patchModule (string Patch)

    Adds a module patch (javac --patch-module).

    • @p Patch is a patch spec such as "mymod=src/patch".
    • @r this object for chaining.
  • arg (string Arg)

    Adds a raw javac flag. This is the escape hatch for any flag not modeled by a setter.

    • @p Arg is the flag to pass through.
    • @r this object for chaining.
  • jdk (string Jdk)

    Overrides the configured JDK for this build only.

    • @p Jdk is the JDK home path.
    • @r this object for chaining.
  • toMap ()

    Converts this options object to the map the backing implementation reads. Called by JavaTools.compile.

    • @r A map with the compile inputs.