diff --git a/src/platform-includes/getting-started-install/java.log4j2.mdx b/src/platform-includes/getting-started-install/java.log4j2.mdx index 05709dc5bc11a9..76db8bd2d4369d 100644 --- a/src/platform-includes/getting-started-install/java.log4j2.mdx +++ b/src/platform-includes/getting-started-install/java.log4j2.mdx @@ -6,6 +6,12 @@ ``` +```groovy {tabTitle:Gradle Plugin} +plugins { + id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" +} +``` + ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-log4j2:{{@inject packages.version('sentry.java.log4j2', '4.2.0') }}' ``` @@ -18,6 +24,8 @@ For other dependency managers see the [central Maven repository](https://search. -If you are using multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. +We recommend using our Gradle plugin as it can add integrations and provide source context for events. + +If you are manually adding multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. diff --git a/src/platform-includes/getting-started-install/java.logback.mdx b/src/platform-includes/getting-started-install/java.logback.mdx index 9e699a87a22198..780b779141b940 100644 --- a/src/platform-includes/getting-started-install/java.logback.mdx +++ b/src/platform-includes/getting-started-install/java.logback.mdx @@ -6,6 +6,12 @@ ``` +```groovy {tabTitle:Gradle Plugin} +plugins { + id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" +} +``` + ```groovy {tabTitle:Gradle} implementation 'io.sentry:sentry-logback:{{@inject packages.version('sentry.java.logback', '4.2.0') }}' ``` @@ -18,6 +24,8 @@ For other dependency managers, see the [central Maven repository](https://search -If you are using multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. +We recommend using our Gradle plugin as it can add integrations and provide source context for events. + +If you are manually adding multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. diff --git a/src/platform-includes/getting-started-install/java.mdx b/src/platform-includes/getting-started-install/java.mdx index 75782afea7ac49..90e8e6be636b9d 100644 --- a/src/platform-includes/getting-started-install/java.mdx +++ b/src/platform-includes/getting-started-install/java.mdx @@ -1,12 +1,17 @@ ```groovy {filename:build.gradle} // Make sure mavenCentral is there. +buildscript { + repositories { + mavenCentral() + } +} + repositories { mavenCentral() } -// Add Sentry's SDK as a dependency. -dependencies { - implementation 'io.sentry:sentry:{{@inject packages.version('sentry.java', '4.2.0') }}' +plugins { + id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" } ``` @@ -24,6 +29,8 @@ libraryDependencies += "io.sentry" % "sentry" % "{{@inject packages.version('sen -If you are using multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. +We recommend using our Gradle plugin as it can add integrations and provide source context for events. + +If you are manually adding multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. diff --git a/src/platform-includes/getting-started-install/java.spring-boot.mdx b/src/platform-includes/getting-started-install/java.spring-boot.mdx index 0faecae819aa0c..dd7afd4b040022 100644 --- a/src/platform-includes/getting-started-install/java.spring-boot.mdx +++ b/src/platform-includes/getting-started-install/java.spring-boot.mdx @@ -14,6 +14,12 @@ ``` +```groovy {tabTitle:Gradle Plugin} +plugins { + id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" +} +``` + ```groovy {tabTitle:Gradle (Spring Boot 2)} implementation 'io.sentry:sentry-spring-boot-starter:{{@inject packages.version('sentry.java.spring-boot', '4.2.0') }}' ``` @@ -24,6 +30,8 @@ implementation 'io.sentry:sentry-spring-boot-starter-jakarta:{{@inject packages. -If you are using multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. +We recommend using our Gradle plugin as it can add integrations and provide source context for events. + +If you are manually adding multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. diff --git a/src/platform-includes/getting-started-install/java.spring.mdx b/src/platform-includes/getting-started-install/java.spring.mdx index 133fbea2b1b48c..df387834934a6b 100644 --- a/src/platform-includes/getting-started-install/java.spring.mdx +++ b/src/platform-includes/getting-started-install/java.spring.mdx @@ -14,6 +14,12 @@ ``` +```groovy {tabTitle:Gradle Plugin} +plugins { + id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}" +} +``` + ```groovy {tabTitle:Gradle (Spring 5)} implementation 'io.sentry:sentry-spring:{{@inject packages.version('sentry.java.spring', '4.2.0') }}' ``` @@ -34,6 +40,8 @@ For other dependency managers see the [central Maven repository (Spring 5)](http -If you are using multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. +We recommend using our Gradle plugin as it can add integrations and provide source context for events. + +If you are manually adding multiple Sentry dependencies, you can add a [bill of materials](/platforms/java/configuration/bill-of-materials) to avoid specifying the version of each dependency. diff --git a/src/platform-includes/getting-started-primer/java.spring-boot.mdx b/src/platform-includes/getting-started-primer/java.spring-boot.mdx index be111c603619ec..e5795ccf378fa2 100644 --- a/src/platform-includes/getting-started-primer/java.spring-boot.mdx +++ b/src/platform-includes/getting-started-primer/java.spring-boot.mdx @@ -1,6 +1,6 @@ -There are two variants of Sentry available for Spring Boot. If you're using Spring Boot 2, use `sentry-spring-boot-starter` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-boot-starter)). If you're using Spring Boot 3, use `sentry-spring-boot-starter-jakarta` instead ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-boot-starter-jakarta)). +There are two variants of Sentry available for Spring Boot. If you're using our Gradle plugin it will pick the right dependency for you. If you're manually adding the dependency and using Spring Boot 2, use `sentry-spring-boot-starter` ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-boot-starter)). If you're using Spring Boot 3, use `sentry-spring-boot-starter-jakarta` instead ([GitHub](https://github.com/getsentry/sentry-java/tree/master/sentry-spring-boot-starter-jakarta)). Sentry's integration with [Spring Boot](https://spring.io/projects/spring-boot) supports Spring Boot 2.1.0 and above to report unhandled exceptions as well as release and registration of beans. If you're on an older version, use [our legacy integration](/platforms/java/legacy/spring/). diff --git a/src/platforms/java/common/gradle.mdx b/src/platforms/java/common/gradle.mdx index 11253a23a5e714..a779d11d532f3e 100644 --- a/src/platforms/java/common/gradle.mdx +++ b/src/platforms/java/common/gradle.mdx @@ -5,7 +5,11 @@ description: "Learn about using the Sentry Gradle Plugin." --- The [Sentry Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) is an addition to the main Java SDK and offers -seamless integration with the Gradle build system. It supports the reporting of your application's external dependencies as part of events. +seamless integration with the Gradle build system. It supports the following features: + +- Auto-installation of Sentry Java SDK and relevant integrations +- External dependencies report +- Uploading Source Context ## Setup @@ -72,6 +76,11 @@ sentry { // // Default is enabled. includeDependenciesReport = true + + // Automatically adds Sentry dependencies to your project. + autoInstallation { + enabled = true + } } ``` @@ -100,9 +109,18 @@ sentry { // // Default is enabled. includeDependenciesReport.set(true) + + // Automatically adds Sentry dependencies to your project. + autoInstallation { + enabled.set(true) + } } ``` +## Auto Installation + +The plugin automatically adds the Sentry Java SDK as well as available Sentry integrations as dependencies if it detects a library dependency we support. For example, if your project has a dependency on `graphql-java` the plugin will automatically add `sentry-graphql` as an additional dependency. + ## Source Context See our documentation on Source Context.