Skip to content

Commit 9b391e5

Browse files
authored
Add Gradle to Aviary documentation (#277)
1 parent 386fdbd commit 9b391e5

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

docs/package_firewall/maven.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ printf "<PHYLUM_ORG>/<PHYLUM_GROUP>:<PHYLUM_API_KEY>" | base64
3737
>
3838
> Do not accidentally save your token into your shell history.
3939
40-
Custom Maven registries can be configured in the `${user.home}/.m2/settings.xml`
40+
Custom Maven registries can be configured in the `~/.m2/settings.xml`
4141
file. Replace `[BASE64_OUTPUT]` in this XML with the token you've created in the
4242
previous step:
4343

@@ -95,3 +95,40 @@ A blocked package will show up in `mvn` output as missing:
9595

9696
If a version range is accepted by the manifest, the package manager will
9797
automatically attempt to use a version that passes Phylum's policy.
98+
99+
### Gradle
100+
101+
Custom registries can be configured in the `~/.gradle/init.gradle` file:
102+
103+
```groovy
104+
allprojects {
105+
repositories {
106+
// Deactivate all registries which aren't protected.
107+
all { ArtifactRepository repo ->
108+
if (repo.url.toString() != "https://maven.phylum.io") {
109+
remove repo
110+
}
111+
}
112+
113+
maven {
114+
url = "https://maven.phylum.io"
115+
credentials {
116+
username = "<PHYLUM_ORG>/<PHYLUM_GROUP>"
117+
password = "<PHYLUM_API_KEY>"
118+
}
119+
}
120+
}
121+
}
122+
```
123+
124+
A blocked package will show up in `gradle` output as failed:
125+
126+
```text
127+
runtimeClasspath - Runtime classpath of source set 'main'.
128+
+--- com.google.code.gson:gson:2.10.1 FAILED
129+
+--- com.google.code.gson:gson:{strictly 2.10.1} -> 2.10.1 FAILED
130+
\--- com.google.code.gson:gson:2.10.1 FAILED
131+
```
132+
133+
If a version range is accepted by the manifest, the package manager will
134+
automatically attempt to use a version that passes Phylum's policy.

0 commit comments

Comments
 (0)