public class JkProjectPackaging
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
JkProjectPackaging.JarType |
Modifier and Type | Field and Description |
---|---|
JkRunnables |
actions
Actions to execute when
JkProject.pack() is invoked. |
static java.lang.String |
CREATE_JAR_ACTION
Represents the identifier for an action to create a JAR file in the project lifecycle.
|
JkJavadocProcessor |
javadocProcessor
Provides fluent interface for producing Javadoc.
|
JkConsumers<JkManifest> |
manifestCustomizer
Consumer container for customizing the manifest that will bbe included in constructed Jar files.
|
JkDependencySetModifier |
runtimeDependencies |
Modifier and Type | Method and Description |
---|---|
void |
copyManifestInClassDir()
Copies the manifest file to the class directory.
|
java.nio.file.Path |
createBinJar()
Creates a binary jar at conventional location.
|
void |
createBinJar(java.nio.file.Path target)
Creates a binary jar (without dependencies) at the specified location.
|
java.nio.file.Path |
createFatJar()
Creates a fat jar at conventional location.
|
void |
createFatJar(java.nio.file.Path target)
Creates a fat jar (jar containing all dependencies) at the specified location.
|
java.nio.file.Path |
createJavadocJar()
Creates a Javadoc jar at conventional location.
|
void |
createJavadocJar(java.nio.file.Path target)
Creates a Javadoc jar at the specified location.
|
void |
createShadeJar(java.nio.file.Path target)
Same as createFatJar but relocate packages of the dependency jars in
order to not collide with dependencies in classpath.
|
java.nio.file.Path |
createSourceJar()
Creates a source jar at the specified location.
|
void |
createSourceJar(java.nio.file.Path target)
Creates a source jar at specified location.
|
JkProjectPackaging |
customizeFatJarContent(java.util.function.Function<JkPathTreeSet,JkPathTreeSet> customizer)
Allows customizing thz content of produced fat jar.
|
java.nio.file.Path |
getJavadocDir() |
java.lang.String |
getMainClass()
Returns the main class name of the project.
|
JkManifest |
getManifest() |
java.lang.String |
getOrFindMainClass()
Retrieves the main class name of the project.
|
boolean |
isDetectMainClass() |
JkResolveResult |
resolveRuntimeDependencies()
Returns the resolved (and cached) dependencies needed at runtime.
|
java.util.List<java.nio.file.Path> |
resolveRuntimeDependenciesAsFiles()
Retrieves the runtime dependencies as a sequence of files.
|
void |
run()
Executes the packing process for this project, which includes compiling, testing, and creating JAR files.
|
JkProjectPackaging |
setDetectMainClass(boolean detectMainClass)
Sets whether to detect the main class when running or building the project.
|
JkProjectPackaging |
setJarMaker(java.util.function.Consumer<java.nio.file.Path> jarMaker)
Sets a
Runnable to create the JAR used by JkProject.prepareRunJar(JkProject.RuntimeDeps) |
JkProjectPackaging |
setMainClass(java.lang.String mainClass)
Sets the main class name to use in #runXxx and for building docker images.
|
JkProjectPackaging |
setMainClassFinder(java.util.function.Supplier<java.lang.String> mainClassFinder)
Sets the main class finder for this project.
|
public static final java.lang.String CREATE_JAR_ACTION
public final JkRunnables actions
JkProject.pack()
is invoked.By default, the build action creates a regular binary jar. It can be replaced by an action creating other jars/artifacts or doing special action as publishing a Docker image, for example.
To insert before the JAR action, use JkRunnables.insertBefore(String, String, Runnable)
by specifying the CREATE_JAR_ACTION
as action to insert before.
public final JkConsumers<JkManifest> manifestCustomizer
public final JkJavadocProcessor javadocProcessor
public final JkDependencySetModifier runtimeDependencies
public void run()
actions
public JkProjectPackaging setJarMaker(java.util.function.Consumer<java.nio.file.Path> jarMaker)
Runnable
to create the JAR used by JkProject.prepareRunJar(JkProject.RuntimeDeps)
public java.nio.file.Path getJavadocDir()
public JkManifest getManifest()
public void createJavadocJar(java.nio.file.Path target)
public java.nio.file.Path createJavadocJar()
public void createSourceJar(java.nio.file.Path target)
public java.nio.file.Path createSourceJar()
public void createBinJar(java.nio.file.Path target)
public java.nio.file.Path createBinJar()
public void createFatJar(java.nio.file.Path target)
public void createShadeJar(java.nio.file.Path target)
public java.nio.file.Path createFatJar()
public JkProjectPackaging setDetectMainClass(boolean detectMainClass)
public boolean isDetectMainClass()
public JkProjectPackaging setMainClass(java.lang.String mainClass)
public JkProjectPackaging setMainClassFinder(java.util.function.Supplier<java.lang.String> mainClassFinder)
public java.lang.String getMainClass()
null
for
library projects.public java.lang.String getOrFindMainClass()
public JkProjectPackaging customizeFatJarContent(java.util.function.Function<JkPathTreeSet,JkPathTreeSet> customizer)
public JkResolveResult resolveRuntimeDependencies()
public java.util.List<java.nio.file.Path> resolveRuntimeDependenciesAsFiles()
public void copyManifestInClassDir()