Open jkodroff opened 2 years ago
Also, here's the only addition to my pom.xml
from what I had from pulumi new java
:
<dependency>
<groupId>com.pulumi</groupId>
<artifactId>azure-native</artifactId>
<version>(,2.0]</version>
</dependency>
It seems that the only difference between my working version and @jkodroff hanging version is this diff. and swapping the order resolves it.
% diff --side-by-side pom.xml pom.josh.xml
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://maven.apache.org/POM/4.0. xsi:schemaLocation="http://maven.apache.org/POM/4.0.
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.pulumi</groupId> <groupId>com.pulumi</groupId>
<artifactId>java</artifactId> | <artifactId>my-first-azure-app</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release> <maven.compiler.release>11</maven.compiler.release>
<mainClass>myproject.App</mainClass> <mainClass>myproject.App</mainClass>
<mainArgs/> <mainArgs/>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.pulumi</groupId> <groupId>com.pulumi</groupId>
<artifactId>pulumi</artifactId> | <artifactId>azure-native</artifactId>
<version>(,1.0]</version> | <version>(,2.0]</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.pulumi</groupId> <groupId>com.pulumi</groupId>
<artifactId>azure-native</artifactId> | <artifactId>pulumi</artifactId>
<version>(,2.0]</version> | <version>(,1.0]</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version> <version>3.2.2</version>
<configuration> <configuration>
<archive> <archive>
<manifest> <manifest>
<addClasspath>true</addClasspath> <addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClas <mainClass>${mainClass}</mainClas
</manifest> </manifest>
</archive> </archive>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId <artifactId>maven-assembly-plugin</artifactId
<version>3.3.0</version> <version>3.3.0</version>
<configuration> <configuration>
<archive> <archive>
<manifest> <manifest>
<addClasspath>true</addClasspath> <addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClas <mainClass>${mainClass}</mainClas
</manifest> </manifest>
</archive> </archive>
<descriptorRefs> <descriptorRefs>
<descriptorRef>jar-with-dependencies< <descriptorRef>jar-with-dependencies<
</descriptorRefs> </descriptorRefs>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>make-my-jar-with-dependencies</id <id>make-my-jar-with-dependencies</id
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>single</goal> <goal>single</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version> <version>3.0.0</version>
<configuration> <configuration>
<mainClass>${mainClass}</mainClass> <mainClass>${mainClass}</mainClass>
<commandlineArgs>${mainArgs}</commandline <commandlineArgs>${mainArgs}</commandline
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-wrapper-plugin</artifactId> <artifactId>maven-wrapper-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<configuration> <configuration>
<mavenVersion>3.8.5</mavenVersion> <mavenVersion>3.8.5</mavenVersion>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
With com.pulumi.pulumi
first:
$ mvn dependency:tree
[INFO] com.pulumi:my-first-azure-app:jar:1.0-SNAPSHOT
[INFO] +- com.pulumi:pulumi:jar:0.5.4:compile
[INFO] | +- io.grpc:grpc-protobuf:jar:1.38.0:runtime
[INFO] | | +- io.grpc:grpc-api:jar:1.38.0:runtime
[INFO] | | | \- io.grpc:grpc-context:jar:1.38.0:runtime
[INFO] | | +- com.google.api.grpc:proto-google-common-protos:jar:2.0.1:runtime
[INFO] | | +- io.grpc:grpc-protobuf-lite:jar:1.38.0:runtime
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.4.0:compile
[INFO] | | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.19:runtime
[INFO] | +- io.grpc:grpc-stub:jar:1.38.0:runtime
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- net.javacrumbs.future-converter:future-converter-java8-guava:jar:1.2.0:runtime
[INFO] | | +- net.javacrumbs.future-converter:future-converter-common:jar:1.2.0:runtime
[INFO] | | +- net.javacrumbs.future-converter:future-converter-java8-common:jar:1.2.0:runtime
[INFO] | | \- net.javacrumbs.future-converter:future-converter-guava-common:jar:1.2.0:runtime
[INFO] | +- com.google.guava:guava:jar:31.1-jre:compile
[INFO] | | +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] | | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] | | +- org.checkerframework:checker-qual:jar:3.12.0:compile
[INFO] | | \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] | +- com.google.code.gson:gson:jar:2.8.9:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:3.21.1:runtime
[INFO] | +- com.google.protobuf:protobuf-java-util:jar:3.21.1:runtime
[INFO] | \- io.grpc:grpc-netty-shaded:jar:1.38.0:runtime
[INFO] | \- io.grpc:grpc-core:jar:1.38.0:runtime (version selected from constraint [1.38.0,1.38.0])
[INFO] | +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO] | \- io.perfmark:perfmark-api:jar:0.23.0:runtime
[INFO] \- com.pulumi:azure-native:jar:1.63.0:compile
With azure-native
first:
$ mvn dependency:tree
➜ my-first-azure-app git:(main) ✗ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.pulumi:my-first-azure-app >--------------------
[INFO] Building my-first-azure-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ my-first-azure-app ---
[INFO] com.pulumi:my-first-azure-app:jar:1.0-SNAPSHOT
[INFO] +- com.pulumi:azure-native:jar:1.63.0:compile
[INFO] | +- com.google.guava:guava:jar:30.1-jre:compile
[INFO] | | +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] | | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] | | +- org.checkerframework:checker-qual:jar:3.5.0:compile
[INFO] | | +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] | | \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] | +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:3.12.0:runtime
[INFO] | \- com.google.protobuf:protobuf-java-util:jar:3.12.0:runtime
[INFO] \- com.pulumi:pulumi:jar:0.5.4:compile
[INFO] +- io.grpc:grpc-protobuf:jar:1.38.0:runtime
[INFO] | +- io.grpc:grpc-api:jar:1.38.0:runtime
[INFO] | | \- io.grpc:grpc-context:jar:1.38.0:runtime
[INFO] | +- com.google.api.grpc:proto-google-common-protos:jar:2.0.1:runtime
[INFO] | +- io.grpc:grpc-protobuf-lite:jar:1.38.0:runtime
[INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.19:runtime
[INFO] +- io.grpc:grpc-stub:jar:1.38.0:runtime
[INFO] +- net.javacrumbs.future-converter:future-converter-java8-guava:jar:1.2.0:runtime
[INFO] | +- net.javacrumbs.future-converter:future-converter-common:jar:1.2.0:runtime
[INFO] | +- net.javacrumbs.future-converter:future-converter-java8-common:jar:1.2.0:runtime
[INFO] | \- net.javacrumbs.future-converter:future-converter-guava-common:jar:1.2.0:runtime
[INFO] \- io.grpc:grpc-netty-shaded:jar:1.38.0:runtime
[INFO] \- io.grpc:grpc-core:jar:1.38.0:runtime (version selected from constraint [1.38.0,1.38.0])
[INFO] +- com.google.android:annotations:jar:4.1.1.4:runtime
[INFO] \- io.perfmark:perfmark-api:jar:0.23.0:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.466 s
[INFO] Finished at: 2022-08-18T13:11:24-04:00
Thank you for your report. This is a very interesting find.
After brief discussion with @t0yv0 we believe this is a transient dependency issue that surfaced with netty implementation of gRPC. If we are right, the classpath somehow has two gRPC versions and the netty one gets priority under very specific circumstances. But it might be something else as well.
And I agree this is very unfortunate and hard to debug problem.
I think that the path to resolution here would be exclusions. Currently on main, we apply exclusions to Pulumi Java SDK, so that transitive dependencies are consistent. We might need to also automatically apply exclusions to auto-generated build files for Pulumi Java providers similarly, so transitive dependencies of programs using Pulumi+Providers are consistent. This can be checked by the Maven Enforcer plugin. Once we get to a project with a provider that has consistent transient dependencies we should verify that:
switching pom order does not change the output of mvn dependency:tree
the example code works as expected
This is quite a bit of legwork but worth pursuing at some point to get the best experience for Pulumi Java users.
The following Pulumi program hangs indefinitely on my machine:
pulumi up --logtostderr --logflow -v=9 2> out.txt
output (I let it go until it stopped producing additional logged output, then hit ctrl-c):pulumi about
output: