I would like to use GCP Secrets Manager for my Java 9+ application. The main trouble comes when using the module-info.java file, if I use a version of Java less than 9 that doesn't have the module-info.java file, then it works fine. The main error that comes up is The import com.google.cloud.secretmanager.v1.SecretVersion cannot be resolvedJava(268435846).
, and that applies to the following classes:
AccessSecretVersionResponse
ProjectName
Replication
Secret
SecretPayload
SecretVersion
However, I am able to use VS Code's intellisense and click into the Class file that the import references.
Steps to reproduce:
- Create a new MVN project mvn archetype:generate in a new folder, following prompts.
- Add the following code in pom.xml in their respective areas to turn it into a Java Version 11 project
<properties>
<java.version>11</java.version>
</properties>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source> <!-- same as <java.version> -->
<target>11</target> <!-- same as <java.version> -->
</configuration>
</plugin>
- Copy and paste quickstart instructions from https://cloud.google.com/secret-manager/docs/reference/libraries#client-libraries-install-java in the main Java file.