Skip to content

Commit

Permalink
Move applicationMonitor gen to StartDebugMojo:copyConfigFiles to supp…
Browse files Browse the repository at this point in the history
…ort more goals
  • Loading branch information
evie-lau committed Aug 10, 2023
1 parent 3db9505 commit b5757c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ private void doDeploy() throws IOException, MojoExecutionException, TransformerE
getLog().warn(messages.getString("warn.install.app.add.configuration"));
applicationXml.writeApplicationXmlDocument(serverDirectory);
}

// create applicationMonitor configuration in configDropins/defaults
appMonXml.writeAppMonitorConfigXmlDocument(serverDirectory, appMonitorTrigger);
}

private void installSpringBootApp() throws MojoExecutionException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public abstract class DeployMojoSupport extends LooseAppSupport {
protected File copyLibsDirectory;

protected ApplicationXmlDocument applicationXml = new ApplicationXmlDocument();
protected ApplicationMonitorConfigXmlDocument appMonXml = new ApplicationMonitorConfigXmlDocument("maven");

protected void installApp(Artifact artifact) throws MojoExecutionException, IOException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@
import org.twdata.maven.mojoexecutor.MojoExecutor.Element;

import io.openliberty.tools.ant.ServerTask;
import io.openliberty.tools.common.plugins.config.ApplicationMonitorConfigXmlDocument;
import io.openliberty.tools.common.plugins.config.ServerConfigXmlDocument;
import io.openliberty.tools.common.plugins.util.PluginExecutionException;
import io.openliberty.tools.maven.ServerFeatureSupport;
import io.openliberty.tools.maven.applications.LooseWarApplication;
import io.openliberty.tools.maven.utils.CommonLogger;
import io.openliberty.tools.maven.utils.ExecuteMojoUtil;

/**
Expand Down Expand Up @@ -97,6 +100,8 @@ public abstract class StartDebugMojoSupport extends ServerFeatureSupport {
protected Map<String,String> combinedBootstrapProperties = null;
protected List<String> combinedJvmOptions = null;

protected ApplicationMonitorConfigXmlDocument appMonXml = new ApplicationMonitorConfigXmlDocument("maven");

@Component
protected BuildPluginManager pluginManager;

Expand Down Expand Up @@ -661,6 +666,15 @@ protected void copyConfigFiles() throws IOException, MojoExecutionException {

configFilesCopied = true;

// create applicationMonitor configuration in configDropins/defaults
try {
// TODO: do proper logging for writing/deleting the config file (but logic is in ci.common)
getLog().debug("Writing or deleting configDropins applicationMonitor config file based on `appMonitorTrigger`: " + appMonitorTrigger);
appMonXml.writeAppMonitorConfigXmlDocument(serverDirectory, appMonitorTrigger);
} catch (TransformerException | ParserConfigurationException | PluginExecutionException e) {
throw new MojoExecutionException("Error writing configDropins applicationMonitor file", e);
}

// Now process the copyDependencies configuration
copyDependencies();
}
Expand Down

0 comments on commit b5757c6

Please sign in to comment.