Interface JavaProject
- All Superinterfaces:
FileProject,Project
- All Known Subinterfaces:
KotlinProject
Extends @link FileProject} with functionality for building Java applications and libraries.
Utility methods are provided for
compilingJava code- running
unit tests - generating
JavaDoc - downloading
dependenciesfrom the Maven repository - creating
jar files
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringGenerates a classpath string suitable for the java compilerdefault voidDeletes the package resolver's cachedefault FileCreates a.jararchivedefault voidRuns a Java process.default FilesetCompiles Java code.default FilesetRuns the JavaDoc tooldefault FilesetRuns unit tests using the jUnit console library specified byjUnitLib()default FilesetjUnitLib()Specifies the jUnit console and runtime libraries.default PackageResolverGets the package dependency resolver.default StringGets the location of the package cachedefault FilesetGets dependenciesMethods inherited from interface FileProject
buildPath, buildPath, builtFiles, clean, exec, exec, read, rmdir, sourceFile, sourceFiles, sourcePath, write
-
Method Details
-
java
Runs a Java process.- Parameters:
args- arguments to be supplied to the Java runtime- See Also:
-
javac
Compiles Java code.- Parameters:
path- the directory path for class files, relative toFileProject.buildPath()sources- the source files to compileargs- the command-line options to be passed to the javac compiler- Returns:
- a reference to the compiled
.classfiles - See Also:
-
classpath
-
packageResolver
Gets the package dependency resolver. The default implementation uses Apache Ivy to download packages from the Maven repository.- Returns:
- the package resolver
-
resolve
-
pkgCachePath
Gets the location of the package cache- Returns:
- the path of the package cache directory
-
cleanPkgCache
default void cleanPkgCache()Deletes the package resolver's cache -
jUnitLib
Specifies the jUnit console and runtime libraries.- Returns:
- a dependency referencing the jUnit libraries
-
junit
Runs unit tests using the jUnit console library specified byjUnitLib()- Parameters:
reportsDir- the path of generated unit test report, relative toFileProject.buildPath()args- command line arguments to the jUnit console runtime- Returns:
- a fileset referring to the unit test report
- See Also:
-
javadoc
Runs the JavaDoc tool- Parameters:
destination- the path of generated unit test report, relative toFileProject.buildPath()args- the command-line arguments for the tool- Returns:
- a reference to the generated documentation
- See Also:
-
jar
-