Class GenPluginProject
The GenPluginProject class is responsible for creating a plugin project template with a specified
project name, group, version, and build tool. It generates the necessary files and directories, and then
packages the project into ZIP and TAR archives.
This class performs the following tasks:
- Creates the project directory structure
- Generates configuration and build files
- Copies the necessary JAR libraries
- Generates example code
- Archives the project into ZIP and TAR formats
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.LoggerLogger instance for logging events during the process of generating a plugin project template, including project creation, file copying, archiving, and error handling. -
Constructor Summary
ConstructorsConstructorDescriptionGenPluginProject(String projectName, String projectGroup, String projectVersion, CodeCollectorSystem buildTool, String projectPath, String nameJar) Constructs aGenPluginProjectinstance with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteDirectory(@NotNull File projectDir) Deletes the specified project directory and its contents.voidGenerates the plugin project template, including project structure, files, and archives.
-
Field Details
-
log
public static final org.slf4j.Logger logLogger instance for logging events during the process of generating a plugin project template, including project creation, file copying, archiving, and error handling.This logger is used to record key events during the creation of the plugin project template, such as:
- Warnings when overwriting an existing project directory.
- Info logs when files are successfully created or copied.
- Error logs when issues occur, such as IO problems during file creation or copying.
- Messages about the project being successfully archived in ZIP and TAR formats.
The logger uses the SLF4J framework, providing flexibility to configure log levels (e.g., INFO, WARN, ERROR) and output destinations (console, log files, etc.). This ensures that developers can track the steps of the project generation process and diagnose issues as they arise.
Example log outputs:
- Informational log: "File
file-pathcreated successfully." - Warning log: "Deleting previous root directory..."
- Error log: "Error creating ZIP archive:
error-message"
By using this logger, users can monitor the status of the project template generation, track file operations, and quickly diagnose any issues encountered during the process.
-
-
Constructor Details
-
GenPluginProject
public GenPluginProject(String projectName, String projectGroup, String projectVersion, CodeCollectorSystem buildTool, String projectPath, String nameJar) Constructs aGenPluginProjectinstance with the specified parameters.- Parameters:
projectName- The name of the project (e.g., "MyPlugin").projectGroup- The group of the project (e.g., "com.example").projectVersion- The version of the project (e.g., "1.0.0").buildTool- The build tool used for the project (e.g., Gradle, Maven).projectPath- The path where the project files should be created.nameJar- The name of the JAR file to be copied to the project.
-
-
Method Details
-
generateProject
public void generateProject()Generates the plugin project template, including project structure, files, and archives. This method creates the project directory, generates configuration files, copies required JARs, and then creates ZIP and TAR archives of the project.- Throws:
RuntimeException- if there is an error during project generation.
-
deleteDirectory
Deletes the specified project directory and its contents.- Parameters:
projectDir- The project directory to be deleted.
-