use of com.microsoft.azure.toolkit.maven.common.messager.MavenAzureMessager in project azure-maven-plugins by microsoft.
the class AbstractAzureMojo method execute.
// region Entry Point
@Override
public void execute() throws MojoExecutionException {
try {
AzureMessager.setDefaultMessager(new MavenAzureMessager());
Azure.az().config().setLogLevel(HttpLogDetailLevel.NONE.name());
Azure.az().config().setUserAgent(getUserAgent());
// init proxy manager
initMavenSettingsProxy(Optional.ofNullable(this.session).map(MavenSession::getRequest).orElse(null));
ProxyManager.getInstance().applyProxy();
initTelemetryProxy();
telemetryProxy.addDefaultProperty(PROXY, String.valueOf(ProxyManager.getInstance().isProxyEnabled()));
// Work around for Application Insights Java SDK:
// Sometimes, NoClassDefFoundError will be thrown even after Maven build is completed successfully.
// An issue has been filed at https://github.com/Microsoft/ApplicationInsights-Java/issues/416
// Before this issue is fixed, set default uncaught exception handler for all threads as work around.
Thread.setDefaultUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler());
final Properties prop = new Properties();
if (isFirstRun(prop)) {
infoWithMultipleLines(PRIVACY_STATEMENT);
updateConfigurationFile(prop);
}
if (isSkipMojo()) {
Log.info("Skip execution.");
onSkipped();
} else {
beforeMojoExecution();
doExecute();
afterMojoExecution();
}
} catch (Exception e) {
onMojoError(e);
} finally {
// /main/java/com/microsoft/applicationinsights/internal/channel/common/ApacheSender43.java#L103
try {
// Sleep to wait ai sdk flush telemetries
Thread.sleep(2 * 1000);
} catch (InterruptedException e) {
// swallow this exception
}
ApacheSenderFactory.INSTANCE.create().close();
}
}
Aggregations