1
+ # gwo-agent
2
+
1
3
Have you ever needed to build a project using Gradle Wrapper pointing to distribution inaccessible through your company
2
4
firewall? Typically we modify the ` wrapper.properties ` , resulting in a "dirty" build, or ignore the Wrapper
3
5
altogether and build with a locally installed Gradle distribution.
@@ -9,37 +11,37 @@ giving you extra control over the build distribution, without modifying the chec
9
11
10
12
All you need is to download the latest version [ ![ Release] ( https://jitpack.io/v/ddimtirov/gwo-agent.svg )] ( https://jitpack.io/#ddimtirov/gwo-agent ) or use ` curl ` :
11
13
12
- ```` bash
14
+ ``` sh
13
15
curl -o gwo-agent.jar https://jitpack.io/com/github/ddimtirov/gwo-agent/1.2.0/gwo-agent-1.2.0.jar
14
- ````
16
+ ```
15
17
16
18
And inject the agent into the Gradle wrapper using environment variable such as ` GRADLE_OPTS ` :
17
19
18
- ```` bash
20
+ ``` sh
19
21
export GRADLE_OPTS=-javaagent:gwo-agent.jar=distributionUrl=https://mymirror/gradle-4.10-all.zip
20
- ````
22
+ ```
21
23
22
24
Or in case of high security environments, specify the sha256 checksum too:
23
25
24
- ```` bash
26
+ ``` sh
25
27
export GRADLE_OPTS=-javaagent:gwo-agent.jar=distributionUrl=https://mymirror/gradle-4.10-all.zip,distributionSha256Sum=371cb9fbebbe9880d147f59bab36d61eee122854ef8c9ee1ecf12b82368bcf10
26
- ````
28
+ ```
27
29
28
30
Once this is done, you may use the standard agent and ` gradlew ` script as normal:
29
31
30
- ```` bash
32
+ ``` sh
31
33
gradlew --version
32
34
gradlew clean pub
33
- ````
35
+ ```
34
36
35
- *** Note:*** If ` GRADLE_OPTS ` is already used by your build, you may as well use ` JAVA_TOOL_OPTIONS ` and ` _JAVA_OPTIONS ` ,
37
+ *** Note:*** If ` GRADLE_OPTS ` is already used by your build, you may as well use ` JAVA_TOOL_OPTIONS ` and ` _JAVA_OPTIONS ` ,
36
38
though keep in mind these will impact any other Java process.
37
39
38
40
## Advanced usage
39
41
40
42
Often you would want to edit a small part of a property. For example:
41
-
42
- ```` bash
43
+
44
+ ``` sh
43
45
# replace a blacklisted Gradle version with a good one
44
46
set GRADLE_OPTS=-javaagent:build/gwo-agent.jar=distributionUrl~=/4.10-bin/4.10.2-bin/
45
47
@@ -48,7 +50,7 @@ set GRADLE_OPTS=-javaagent:build/gwo-agent.jar=distributionUrl~=/-([0-9\.]+)-(bi
48
50
49
51
# use same version from alternative download site
50
52
set GRADLE_OPTS=-javaagent:build/gwo-agent.jar=distributionUrl~=@https://services.gradle.org/distributions@https://mymirror/gradle/@
51
- ````
53
+ ```
52
54
53
55
In summary, the syntax for property transformation is:
54
56
@@ -62,14 +64,14 @@ Especially with the transform options, sometimes we may want to get extra insigh
62
64
63
65
Set the ` gwo.debug.resolution ` JVM property to ` true ` to dump details about the properties which are handled by the agent.
64
66
65
- ```` bash
67
+ ``` sh
66
68
> set GRADLE_OPTS=-Dgwo.debug.resolution=true -javaagent:build/gwo-agent.jar=distributionUrl~=/4.10.2-bin/4.10-bin/,distributionSha256Sum=abc123
67
69
68
70
> gradlew --version
69
71
Transformed Gradle Wrapper property: distributionUrl = ' https://services.gradle.org/distributions/gradle-4.10.2-bin.zip' -> ' https://services.gradle.org/distributions/gradle-4.10-bin.zip'
70
72
Overrode Gradle Wrapper property: distributionSha256Sum = ' abc123'
71
- ````
73
+ ```
72
74
73
- Finally, if you need to check whether the agent is instrumenting the right classes, set
74
- the ` gwo.debug.instrumentation ` JVM property to ` true ` to dump details about ByteBuddy's
75
+ Finally, if you need to check whether the agent is instrumenting the right classes, set
76
+ the ` gwo.debug.instrumentation ` JVM property to ` true ` to dump details about ByteBuddy's
75
77
class inspection and instrumentation.
0 commit comments