Skip to content

Commit

Permalink
deps: remove duplicate dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Nov 19, 2024
1 parent 1d89de5 commit 15ea4c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
15 changes: 0 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,6 @@
</dependency>

<!-- Add OpenTelemetry implementation and exporters for use in integration tests -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud.opentelemetry</groupId>
<artifactId>exporter-trace</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ public void setup() {

@Test
public void testUseSingleJar() throws Exception {
printDeps();
buildSingleJar();
buildMainClass();
runTestApplication();
}

@Test
public void testUseShadedJar() throws Exception {
printDeps();
buildShadedJar();
buildMainClass();
runTestApplication();
Expand All @@ -91,6 +93,12 @@ private void runTestApplication() throws Exception {
execute(builder);
}

private void printDeps() throws Exception {
ProcessBuilder builder = new ProcessBuilder();
builder.command("mvn", "dependency:tree");
execute(builder, true);
}

private void buildSingleJar() throws Exception {
ProcessBuilder builder = new ProcessBuilder();
builder.command("mvn", "clean", "package", "-DskipTests", "-Dalt.build.dir=./target/single");
Expand All @@ -116,11 +124,23 @@ private void buildMainClass() throws Exception {
}

private void execute(ProcessBuilder builder) throws Exception {
execute(builder, false);
}

private void execute(ProcessBuilder builder, boolean showOutput) throws Exception {
Process process = builder.start();
String errors;
String errors, output = "";
try (InputStreamReader reader = new InputStreamReader(process.getErrorStream())) {
errors = CharStreams.toString(reader);
}
if (showOutput) {
try (InputStreamReader reader = new InputStreamReader(process.getInputStream())) {
output = CharStreams.toString(reader);
}
}
assertEquals(errors, 0, process.waitFor());
if (showOutput) {
System.out.print(output);
}
}
}

0 comments on commit 15ea4c5

Please sign in to comment.