Skip to content

Consolidate dev mode prereq checks to be at the start of the goal/task #1074

Open
@TrevCraw

Description

@TrevCraw

Prerequisite checks before starting up dev mode (such as checking for an already running server, or container, and checking the Docker version) should occur as early as possible in the dev goal/task. They should be located in the ci.maven and ci.gradle files DevMojo.java and DevTask.groovy at the start of the methods doExecute() and action() respectfully. The server running check is already located in the correct spot, so checks for the Docker version and for a running container need to be added.

This will require some refactoring, as the DevUtil object is not created at the point where these prereq checks need to occur. There are a few options:

  1. Create static prereq check methods and convert many existing non-static methods in DevUtil.java to static. This leads to difficulties as these methods rely on other non-static methods such as error(), warn(), and debug(). It can be a cascade of non-static dependency.
  2. Move the prereq related methods into a parent of DevUtil or into a totally separate Util class.
  3. Create a "light" instance of a DevUtil object that uses the smallest amount of values in construction, and discard it after running the prereq methods. Create the "real" DevUtil object later on.
  4. Modify the constructor for DevUtil to be the bare minimum so the "real" DevUtil object can be constructed earlier on and used for the prereq methods. Then use an init() method to fully initialize the DevUtil object with all the necessary values that are created after the prereq checks.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

New Issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions