Skip to content

Commit 653ac38

Browse files
Document SAGP auto install for backend (#7608)
Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com>
1 parent 7825b88 commit 653ac38

File tree

7 files changed

+67
-10
lines changed

7 files changed

+67
-10
lines changed

src/platform-includes/getting-started-install/java.log4j2.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
</dependency>
77
```
88

9+
```groovy {tabTitle:Gradle Plugin}
10+
plugins {
11+
id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}"
12+
}
13+
```
14+
915
```groovy {tabTitle:Gradle}
1016
implementation 'io.sentry:sentry-log4j2:{{@inject packages.version('sentry.java.log4j2', '4.2.0') }}'
1117
```
@@ -18,6 +24,8 @@ For other dependency managers see the [central Maven repository](https://search.
1824

1925
<Note>
2026

21-
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.
27+
We recommend using our Gradle plugin as it can add integrations and provide source context for events.
28+
29+
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.
2230

2331
</Note>

src/platform-includes/getting-started-install/java.logback.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
</dependency>
77
```
88

9+
```groovy {tabTitle:Gradle Plugin}
10+
plugins {
11+
id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}"
12+
}
13+
```
14+
915
```groovy {tabTitle:Gradle}
1016
implementation 'io.sentry:sentry-logback:{{@inject packages.version('sentry.java.logback', '4.2.0') }}'
1117
```
@@ -18,6 +24,8 @@ For other dependency managers, see the [central Maven repository](https://search
1824

1925
<Note>
2026

21-
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.
27+
We recommend using our Gradle plugin as it can add integrations and provide source context for events.
28+
29+
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.
2230

2331
</Note>

src/platform-includes/getting-started-install/java.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
```groovy {filename:build.gradle}
22
// Make sure mavenCentral is there.
3+
buildscript {
4+
repositories {
5+
mavenCentral()
6+
}
7+
}
8+
39
repositories {
410
mavenCentral()
511
}
612
7-
// Add Sentry's SDK as a dependency.
8-
dependencies {
9-
implementation 'io.sentry:sentry:{{@inject packages.version('sentry.java', '4.2.0') }}'
13+
plugins {
14+
id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}"
1015
}
1116
```
1217

@@ -24,6 +29,8 @@ libraryDependencies += "io.sentry" % "sentry" % "{{@inject packages.version('sen
2429

2530
<Note>
2631

27-
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.
32+
We recommend using our Gradle plugin as it can add integrations and provide source context for events.
33+
34+
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.
2835

2936
</Note>

src/platform-includes/getting-started-install/java.spring-boot.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
</dependency>
1515
```
1616

17+
```groovy {tabTitle:Gradle Plugin}
18+
plugins {
19+
id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}"
20+
}
21+
```
22+
1723
```groovy {tabTitle:Gradle (Spring Boot 2)}
1824
implementation 'io.sentry:sentry-spring-boot-starter:{{@inject packages.version('sentry.java.spring-boot', '4.2.0') }}'
1925
```
@@ -24,6 +30,8 @@ implementation 'io.sentry:sentry-spring-boot-starter-jakarta:{{@inject packages.
2430

2531
<Note>
2632

27-
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.
33+
We recommend using our Gradle plugin as it can add integrations and provide source context for events.
34+
35+
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.
2836

2937
</Note>

src/platform-includes/getting-started-install/java.spring.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
</dependency>
1515
```
1616

17+
```groovy {tabTitle:Gradle Plugin}
18+
plugins {
19+
id "io.sentry.jvm.gradle" version "{{@inject packages.version('sentry.java.android.gradle-plugin', '3.12.0') }}"
20+
}
21+
```
22+
1723
```groovy {tabTitle:Gradle (Spring 5)}
1824
implementation 'io.sentry:sentry-spring:{{@inject packages.version('sentry.java.spring', '4.2.0') }}'
1925
```
@@ -34,6 +40,8 @@ For other dependency managers see the [central Maven repository (Spring 5)](http
3440

3541
<Note>
3642

37-
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.
43+
We recommend using our Gradle plugin as it can add integrations and provide source context for events.
44+
45+
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.
3846

3947
</Note>

src/platform-includes/getting-started-primer/java.spring-boot.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Note>
22

3-
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)).
3+
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)).
44

55
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/).
66

src/platforms/java/common/gradle.mdx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ description: "Learn about using the Sentry Gradle Plugin."
55
---
66

77
The [Sentry Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) is an addition to the main Java SDK and offers
8-
seamless integration with the Gradle build system. It supports the reporting of your application's external dependencies as part of events.
8+
seamless integration with the Gradle build system. It supports the following features:
9+
10+
- Auto-installation of Sentry Java SDK and relevant integrations
11+
- External dependencies report
12+
- Uploading Source Context
913

1014
## Setup
1115

@@ -72,6 +76,11 @@ sentry {
7276
//
7377
// Default is enabled.
7478
includeDependenciesReport = true
79+
80+
// Automatically adds Sentry dependencies to your project.
81+
autoInstallation {
82+
enabled = true
83+
}
7584
}
7685
```
7786

@@ -100,9 +109,18 @@ sentry {
100109
//
101110
// Default is enabled.
102111
includeDependenciesReport.set(true)
112+
113+
// Automatically adds Sentry dependencies to your project.
114+
autoInstallation {
115+
enabled.set(true)
116+
}
103117
}
104118
```
105119

120+
## Auto Installation
121+
122+
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.
123+
106124
## Source Context
107125

108126
See our documentation on <PlatformLink to="/source-context/">Source Context</PlatformLink>.

0 commit comments

Comments
 (0)