Package io.micronaut.maven
Class RunMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="run",
requiresDependencyResolution=COMPILE_PLUS_RUNTIME,
defaultPhase=PREPARE_PACKAGE,
aggregator=true)
@Execute(phase=PROCESS_CLASSES)
public class RunMojo
extends AbstractTestResourcesMojo
Executes a Micronaut application in development mode.
It watches for changes in the project tree. If there are changes in the pom.xml
file, dependencies will be reloaded. If
the changes are anywhere underneath src/main
, it will recompile the project and restart the application.
The plugin can handle changes in all the languages supported by Micronaut: Java, Kotlin and Groovy.
- Since:
- 1.0.0
- Author:
- Álvaro Sánchez-Mariscal
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class io.micronaut.maven.testresources.AbstractTestResourcesMojo
buildDirectory, classpathInference, clientTimeout, explicitPort, log, pluginContext, serverIdleTimeoutMinutes, testResourcesDependencies, testResourcesVersion
Fields inherited from class io.micronaut.maven.testresources.TestResourcesConfiguration
CONFIG_PROPERTY_PREFIX, debugServer, DISABLED, foreground, shared, sharedServerNamespace, TEST_RESOURCES_ENABLED_PROPERTY, testResourcesEnabled
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
ConstructorDescriptionRunMojo
(org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.plugin.BuildPluginManager pluginManager, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.toolchain.ToolchainManager toolchainManager, CompilerService compilerService, ExecutorService executorService, DependencyResolutionService dependencyResolutionService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
protected final void
protected void
Runs or restarts the application.protected final void
setWatches
(List<org.apache.maven.model.FileSet> watches) Methods inherited from class io.micronaut.maven.testresources.AbstractTestResourcesMojo
getLog, getPluginContext, serverSettingsDirectoryOf, setLog, setPluginContext
Methods inherited from class io.micronaut.maven.testresources.TestResourcesConfiguration
getSharedServerNamespace, isShared, isTestResourcesEnabled, setDebugServer, setShared, setSharedServerNamespace, setTestResourcesEnabled
-
Field Details
-
MN_APP_ARGS
- See Also:
-
EXEC_MAIN_CLASS
- See Also:
-
RESOURCES_DIR
- See Also:
-
THIS_PLUGIN
- See Also:
-
-
Constructor Details
-
RunMojo
@Inject public RunMojo(org.apache.maven.execution.MavenSession mavenSession, org.apache.maven.plugin.BuildPluginManager pluginManager, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.toolchain.ToolchainManager toolchainManager, CompilerService compilerService, ExecutorService executorService, DependencyResolutionService dependencyResolutionService)
-
-
Method Details
-
execute
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
initialize
-
setWatches
-
runApplication
Runs or restarts the application. Only visible for testing, shouldn't be called directly.- Throws:
Exception
- if something goes wrong while starting the application
-