bee.task
FindMain
Provides tasks to find special entry point classes within the project:
main
: Classes containing a standardpublic static void main(String[] args)
method.premain
: Classes containing a Java Agentpremain
method.agentmain
: Classes containing a Java Agentagentmain
method (for dynamic attachment).
main
()
kiss.VariableString
String
kiss.Variable |
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:
- Checks if a main class is already specified in the
Config#main
setting. - If not configured, it uses the
Search
service to find all classes containing a validpublic static void main(String[] args)
method. - If exactly one main class is found, it's used automatically.
- If multiple main classes are found, it prompts the user (via
ui().ask()
) to select one. - If no main class is found or configured, it reports that none exists.
- 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
String
kiss.Variable |
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.
public static void premain(String agentArgs)
or
public static void premain(String agentArgs, java.lang.instrument.Instrumentation inst)
.
agentmain
()
kiss.VariableString
String
kiss.Variable |
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.
public static void agentmain(String agentArgs)
or
public static void agentmain(String agentArgs, java.lang.instrument.Instrumentation inst)
.