Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add appMonitorTrigger parameter to set applicationMonitor updateTrigger override property #1711

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.openliberty.tools.common.plugins.config.LooseConfigData;
import io.openliberty.tools.common.plugins.config.ServerConfigDocument;
import io.openliberty.tools.common.plugins.util.DevUtil;
import io.openliberty.tools.common.plugins.util.PluginExecutionException;

/**
* Copy applications to the specified directory of the Liberty server.
Expand All @@ -59,12 +60,12 @@ public void execute() throws MojoExecutionException {

try {
doDeploy();
} catch (IOException | ParserConfigurationException | TransformerException e) {
} catch (IOException | ParserConfigurationException | TransformerException | PluginExecutionException e) {
throw new MojoExecutionException("Error deploying application.", e);
}
}

private void doDeploy() throws IOException, MojoExecutionException, TransformerException, ParserConfigurationException {
private void doDeploy() throws IOException, MojoExecutionException, TransformerException, ParserConfigurationException, PluginExecutionException {
checkServerHomeExists();
checkServerDirectoryExists();

Expand Down Expand Up @@ -95,7 +96,7 @@ private void doDeploy() throws IOException, MojoExecutionException, TransformerE
default:
return;
}

if (installDependencies) {
installDependencies();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.openliberty.tools.maven.server.LooseAppSupport;
import io.openliberty.tools.maven.utils.CommonLogger;
import io.openliberty.tools.maven.utils.MavenProjectUtil;
import io.openliberty.tools.common.plugins.config.ApplicationMonitorConfigXmlDocument;
import io.openliberty.tools.common.plugins.config.ApplicationXmlDocument;
import io.openliberty.tools.common.plugins.config.LooseApplication;
import io.openliberty.tools.common.plugins.config.LooseConfigData;
Expand Down Expand Up @@ -415,8 +416,9 @@ protected void validateAppConfig(String fullyQualifiedFileName, String fileName,
// add application configuration
getLog().info("Could not find application "+fileName+" in server.xml locations.");
applicationXml.createApplicationElement(fileName, artifactId, isSpringBootApp);
} else if (appsDir.equalsIgnoreCase("dropins") && isAppConfiguredInSourceServerXml(fullyQualifiedFileName, fileName))
} else if (appsDir.equalsIgnoreCase("dropins") && isAppConfiguredInSourceServerXml(fullyQualifiedFileName, fileName)) {
throw new MojoExecutionException(messages.getString("error.install.app.dropins.directory"));
}
}

/**
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 @@ -124,6 +129,9 @@ public abstract class StartDebugMojoSupport extends ServerFeatureSupport {
@Parameter
protected List<String> jvmOptions;

@Parameter(property = "appMonitorTrigger")
protected String appMonitorTrigger;

/**
* The current plugin's descriptor. This is auto-filled by Maven 3.
*/
Expand Down Expand Up @@ -658,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