Skip to content

Commit 2de29bf

Browse files
authored
Fix method for downloading Java Agent jar (#565)
Signed-off-by: Raphael Silva <[email protected]>
1 parent 149ed27 commit 2de29bf

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

java/build.gradle.kts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,28 @@ java {
1919

2020
spotless {
2121
java {
22-
googleJavaFormat("1.9")
22+
googleJavaFormat("1.15.0")
2323
}
2424
}
2525

26+
val javaagentDependency by configurations.creating {
27+
extendsFrom()
28+
}
29+
2630
dependencies {
2731
compileOnly(platform("io.opentelemetry:opentelemetry-bom:1.25.0"))
2832
compileOnly(platform("io.opentelemetry:opentelemetry-bom-alpha:1.25.0-alpha"))
2933
// Already included in wrapper so compileOnly
3034
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
3135
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws")
36+
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:1.26.0")
37+
}
38+
39+
tasks.register<Copy>("download") {
40+
from(javaagentDependency)
41+
into("$buildDir/javaagent")
42+
}
43+
44+
tasks.named("build") {
45+
dependsOn("download")
3246
}

java/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ cp ./build/libs/aws-otel-lambda-java-extensions.jar ../opentelemetry-lambda/java
1919
# Go to OTel Lambda Java folder
2020
cd ../opentelemetry-lambda/java || exit
2121

22-
# Build the OTel Lambda Java folder which has ADOT Lambda Java configured code
23-
OTEL_VERSION=1.24.0
24-
./gradlew build -Potel.lambda.javaagent.dependency=software.amazon.opentelemetry:aws-opentelemetry-agent:$OTEL_VERSION
22+
./gradlew build
2523

2624
# Combine Java Agent build and ADOT Collector
2725
pushd ./layer-javaagent/build/distributions || exit
2826
unzip -qo opentelemetry-javaagent-layer.zip
2927
rm opentelemetry-javaagent-layer.zip
3028
mv otel-handler otel-handler-upstream
3129
cp "$SOURCEDIR"/scripts/otel-handler .
30+
# Copy ADOT Java Agent downloaded using Gradle task
31+
cp "$SOURCEDIR"/build/javaagent/aws-opentelemetry-agent*.jar ./opentelemetry-javaagent.jar
3232
unzip -qo ../../../../collector/build/collector-extension-$1.zip
3333
zip -qr opentelemetry-javaagent-layer.zip *
3434
popd || exit

0 commit comments

Comments
 (0)