bee

bee.task

FindMain

Provides tasks to find special entry point classes within the project:

  • main: Classes containing a standard public static void main(String[] args) method.
  • premain: Classes containing a Java Agent premain method.
  • agentmain: Classes containing a Java Agent agentmain method (for dynamic attachment).
This task scans the project's compiled classes and allows configuration or user interaction to select the desired entry point if multiple candidates are found or if none are explicitly configured.

main()kiss.VariableString

kiss.VariableString

A Variable containing the fully qualified name of the main class, or an empty Variable if none is found or selected.

Finds or determines the main class for the project.

It follows these steps:

  1. Checks if a main class is already specified in the Config#main setting.
  2. If not configured, it uses the Search service to find all classes containing a valid public static void main(String[] args) method.
  3. If exactly one main class is found, it's used automatically.
  4. If multiple main classes are found, it prompts the user (via ui().ask()) to select one.
  5. If no main class is found or configured, it reports that none exists.
  6. The determined main class name (or null if none) is stored back into Config#main for subsequent uses and returned as a Variable.

premain()kiss.VariableString

kiss.VariableString

A Variable containing the fully qualified name of the premain class, or an empty Variable if none is found or selected.

Finds or determines the premain class for the project (Java Agent).

Similar logic to #main(): checks configuration first, then searches using Search, asks the user if multiple candidates exist, reports the outcome, stores the result in Config#premain, and returns it as a Variable.

It looks for classes containing a method with the signature public static void premain(String agentArgs) or public static void premain(String agentArgs, java.lang.instrument.Instrumentation inst).

agentmain()kiss.VariableString

kiss.VariableString

A Variable containing the fully qualified name of the agentmain class, or an empty Variable if none is found or selected.

Finds or determines the agentmain class for the project (Java Agent for dynamic attach).

Similar logic to #main(): checks configuration first, then searches using Search, asks the user if multiple candidates exist, reports the outcome, stores the result in Config#agentmain, and returns it as a Variable.

It looks for classes containing a method with the signature public static void agentmain(String agentArgs) or public static void agentmain(String agentArgs, java.lang.instrument.Instrumentation inst).