use of org.grails.maven.plugin.tools.ForkedGrailsRuntime in project grails-maven by grails.
the class AbstractGrailsMojo method runGrails.
/**
* Executes the requested Grails target. The "targetName" must match a known
* Grails script provided by grails-scripts.
*
* @param targetName The name of the Grails target to execute.
* @param args String of arguments to be passed to the executed Grails target.
* @throws MojoExecutionException if an error occurs while attempting to execute the target.
*/
protected void runGrails(final String targetName, String args) throws MojoExecutionException {
configureMavenProxy();
handleVersionSync();
if (fork) {
ForkedGrailsRuntime fgr = new ForkedGrailsRuntime(createExecutionContext(targetName, args));
if (activateAgent) {
File springLoadedJar = resolveArtifact("org.springframework:springloaded:" + SPRING_LOADED_VERSION);
if (springLoadedJar != null) {
fgr.setReloadingAgent(springLoadedJar);
} else {
getLog().warn("Grails Reloading: org.springframework:springloaded:" + SPRING_LOADED_VERSION + " not found");
getLog().error("Grails Reloading: not enabled");
}
}
fgr.setDebug(forkDebug);
fgr.setMaxMemory(forkMaxMemory);
fgr.setMaxPerm(forkPermGen);
fgr.setMinMemory(forkMinMemory);
try {
fgr.run();
} catch (Exception e) {
throw new RuntimeException("Error forking vm: ", e);
}
} else {
DefaultGrailsRuntime dgr = new DefaultGrailsRuntime(createExecutionContext(targetName, args));
dgr.run();
}
}
Aggregations