diff --git a/CHANGELOG.md b/CHANGELOG.md index 877a51b..f1d761c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Add `aarch64` sentry-cli ([#39](https://github.com/getsentry/sentry-maven-plugin/pull/39)) - This is used when the build is executed inside a docker container on an Apple silicon chip (e.g. M1) - Allow usage of the plugin with JDK 8 ([#37](https://github.com/getsentry/sentry-maven-plugin/pull/37)) +- Add `debug` flag ([#38](https://github.com/getsentry/sentry-maven-plugin/pull/38)) ### Dependencies diff --git a/examples/sentry-maven-plugin-example/pom.xml b/examples/sentry-maven-plugin-example/pom.xml index c767458..126c112 100644 --- a/examples/sentry-maven-plugin-example/pom.xml +++ b/examples/sentry-maven-plugin-example/pom.xml @@ -21,6 +21,8 @@ 1.0-SNAPSHOT true + + false true diff --git a/src/main/java/io/sentry/config/ConfigParser.java b/src/main/java/io/sentry/config/ConfigParser.java index a9a326a..6900283 100644 --- a/src/main/java/io/sentry/config/ConfigParser.java +++ b/src/main/java/io/sentry/config/ConfigParser.java @@ -17,6 +17,7 @@ public class ConfigParser { private static final @NotNull String SKIP_REPORT_DEPENDENCIES_FLAG = "skipReportDependencies"; private static final @NotNull String SKIP_SOURCE_BUNDLE_FLAG = "skipSourceBundle"; private static final @NotNull String DEBUG_SENTRY_CLI_FLAG = "debugSentryCli"; + private static final @NotNull String DEBUG_FLAG = "debug"; private static final @NotNull String ORG_OPTION = "org"; private static final @NotNull String PROJECT_OPTION = "project"; private static final @NotNull String URL_OPTION = "url"; @@ -65,6 +66,10 @@ public class ConfigParser { dom.getChild(DEBUG_SENTRY_CLI_FLAG) != null && Boolean.parseBoolean(dom.getChild(DEBUG_SENTRY_CLI_FLAG).getValue())); + pluginConfig.setDebug( + dom.getChild(DEBUG_FLAG) != null + && Boolean.parseBoolean(dom.getChild(DEBUG_FLAG).getValue())); + pluginConfig.setOrg( dom.getChild(ORG_OPTION) == null ? null : dom.getChild(ORG_OPTION).getValue()); diff --git a/src/main/java/io/sentry/config/PluginConfig.java b/src/main/java/io/sentry/config/PluginConfig.java index 31b4c4e..00b5d4d 100644 --- a/src/main/java/io/sentry/config/PluginConfig.java +++ b/src/main/java/io/sentry/config/PluginConfig.java @@ -16,6 +16,8 @@ public class PluginConfig { public static final @NotNull String DEFAULT_SKIP_TELEMETRY_STRING = "false"; public static final boolean DEFAULT_DEBUG_SENTRY_CLI = false; public static final @NotNull String DEFAULT_DEBUG_SENTRY_CLI_STRING = "false"; + public static final boolean DEFAULT_DEBUG = false; + public static final @NotNull String DEFAULT_DEBUG_STRING = "false"; private boolean skip = DEFAULT_SKIP; private boolean skipAutoInstall = DEFAULT_SKIP_AUTO_INSTALL; @@ -23,6 +25,7 @@ public class PluginConfig { private boolean skipReportDependencies = DEFAULT_SKIP_REPORT_DEPENDENCIES; private boolean skipSourceBundle = DEFAULT_SKIP_SOURCE_BUNDLE; private boolean debugSentryCli = DEFAULT_DEBUG_SENTRY_CLI; + private boolean debug = DEFAULT_DEBUG; private @Nullable String org; private @Nullable String project; @@ -35,7 +38,15 @@ public void setDebugSentryCli(final boolean debugSentryCli) { } public boolean isDebugSentryCli() { - return debugSentryCli; + return debugSentryCli || debug; + } + + public void setDebug(final boolean debug) { + this.debug = debug; + } + + public boolean isDebug() { + return debug; } public void setSentryCliExecutablePath(final @Nullable String sentryCliExecutablePath) { diff --git a/src/main/java/io/sentry/telemetry/SentryTelemetryService.java b/src/main/java/io/sentry/telemetry/SentryTelemetryService.java index 1f28cf7..531066a 100644 --- a/src/main/java/io/sentry/telemetry/SentryTelemetryService.java +++ b/src/main/java/io/sentry/telemetry/SentryTelemetryService.java @@ -85,7 +85,7 @@ public void start( Sentry.init( (options) -> { options.setDsn(SENTRY_SAAS_DSN); - options.setDebug(true); + options.setDebug(pluginConfig.isDebug()); options.setEnablePrettySerializationOutput(false); options.setEnvironment("JVM"); options.setSendModules(false);