Class BaseKBean

java.lang.Object
dev.jeka.core.tool.KBean
dev.jeka.core.tool.builtins.base.BaseKBean
All Implemented Interfaces:
JkBuildable.Supplier

public final class BaseKBean extends KBean implements JkBuildable.Supplier
  • Field Details

    • CREATE_JAR_ACTION

      public static final String CREATE_JAR_ACTION
      See Also:
    • jvmOptions

      public String jvmOptions
    • programArgs

      public String programArgs
    • moduleId

      public String moduleId
    • jarType

    • gitVersioning

      public JkGitVersioning gitVersioning
    • packActions

      public final JkRunnables packActions
      Actions to execute when pack() is invoked.

      By default, the build action creates a fat jar. It can be replaced by an action creating other jars/artifacts or doing special action as publishing a Docker image, for example.

    • manifestCustomizers

      public final JkConsumers<JkManifest> manifestCustomizers
  • Constructor Details

    • BaseKBean

      public BaseKBean()
  • Method Details

    • init

      protected void init()
      Description copied from class: KBean
      This method is called by JeKa engine, right after public fields from command-line or properties have been injected.

      Put your initialization/configuration code here.

      Overrides:
      init in class KBean
    • runMain

      public void runMain()
    • test

      public void test()
    • pack

      public void pack()
    • build

      public void build()
    • runJar

      public void runJar()
    • info

      public void info()
    • depTree

      public void depTree()
    • scaffold

      public void scaffold()
    • buildJar

      public BaseKBean buildJar()
      Builds a JAR file using the provided jarMaker
    • getJarPath

      public Path getJarPath()
      Returns the path to the JAR file created by buildJar() method.
    • getJarPathBaseName

      public String getJarPathBaseName()
      Returns the base name of the JAR file path created by the buildJar() method.
    • setJarMaker

      public BaseKBean setJarMaker(Consumer<Path> jarMaker)
      Sets the jarMaker for creating a runnable fat jar.
    • setVersionSupplier

      public BaseKBean setVersionSupplier(Supplier<JkVersion> versionSupplier)
      Sets the version supplier for this BaseKBean. The version represents the version of the application/library.
    • setVersion

      public BaseKBean setVersion(String version)
      Sets the version for this BaseKBean. The version represents the version of the application/library.
    • getVersion

      public JkVersion getVersion()
      Returns the version of the application/library. The version might be used in Manifest file, docker image name or Maven publication.
    • getModuleId

      public JkModuleId getModuleId()
      Returns the module ID for this object. The module ID is used for naming Docker image and in Maven publication.
    • setModuleId

      public BaseKBean setModuleId(String moduleId)
      Sets the module ID for this object. The module id might be used for naming Docker image and in Maven publication.
      Parameters:
      moduleId - The module ID formatted as group:name.
    • getMainClass

      public String getMainClass()
      Returns the actual main class to be used for launching the application or executable JAR. This method returns null if no main class has been detected.
    • getBaseScaffold

      public JkBaseScaffold getBaseScaffold()
      Returns the JkBaseScaffold object associated with this BaseKBean. The JkBaseScaffold provides methods for configuring the project scaffold, such as adding file entries and setting options.
    • setMainClassFinder

      public BaseKBean setMainClassFinder(Supplier<String> mainClassFinder)
      Sets the main class finder for this project. The main class finder is responsible for providing the name of the main class to use in the project. This can be used for running the project or building Docker images.
    • getAppClasspath

      public List<Path> getAppClasspath()
      Returns the application classpath. This contains class dir + libraries.
    • getAppLibs

      public List<Path> getAppLibs()
      Returns a List of Path objects representing the libraries used by the application. It contains the classpath minus the class dir.
    • getAppClasses

      public JkPathTree getAppClasses()
      Returns a JkPathTree representing the class files and sub-folders contained in the "bin" directory. The tree includes all files in the root directory and its subdirectories, except for files matching the specified patterns.
    • getManifest

      public JkManifest getManifest()
      Returns the JkManifest for the application. The manifest includes the created by attribute, the main class attribute, and the build JDK attribute.
    • createMainJar

      public void createMainJar(Path target)
      Creates a main JAR file at the specified target path.
    • createJavadocJar

      public void createJavadocJar(Path target)
      Creates a Javadoc Jar file at the specified target path.
    • createSourceJar

      public void createSourceJar(Path target)
      Creates a source JAR file at the specified target path.
    • getAppSources

      public JkPathTree getAppSources()
      Returns a JkPathTree representing the application sources.
    • prepareRunJar

      public JkJavaProcess prepareRunJar()
    • setMainArtifactJarType

      public BaseKBean setMainArtifactJarType(JkProjectPackaging.JarType jarType)
    • asBuildable

      public JkBuildable asBuildable()
      Specified by:
      asBuildable in interface JkBuildable.Supplier