$ git clone https://github.com/googleapis/java-spanner.git
$ cd java-spanner/samples/snippets
$ mvn package
However, the compilation failed. Note that I did the same thing a while ago and it did work. So I guess this is caused by recent releases that include incompatible changes?
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/TracingSample.java: /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/TracingSample.java uses or overrides a deprecated API.
[WARNING] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/TracingSample.java: Recompile with -Xlint:deprecation for details.
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateBackupWithEncryptionKey.java:[30,43] package com.google.cloud.spanner.encryption does not exist
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[26,32] cannot find symbol
symbol: class Restore
location: package com.google.cloud.spanner
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[30,43] package com.google.cloud.spanner.encryption does not exist
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[28,43] package com.google.cloud.spanner.encryption does not exist
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateBackupWithEncryptionKey.java:[72,30] cannot find symbol
symbol: variable EncryptionConfigs
location: class com.example.spanner.CreateBackupWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[62,11] cannot find symbol
symbol: class Restore
location: class com.example.spanner.RestoreBackupWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[63,9] cannot find symbol
symbol: method newRestoreBuilder(com.google.cloud.spanner.BackupId,com.google.cloud.spanner.DatabaseId)
location: variable adminClient of type com.google.cloud.spanner.DatabaseAdminClient
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[66,30] cannot find symbol
symbol: variable EncryptionConfigs
location: class com.example.spanner.RestoreBackupWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[92,17] cannot find symbol
symbol: method getEncryptionConfig()
location: variable database of type com.google.cloud.spanner.Database
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[60,9] cannot find symbol
symbol: method newDatabaseBuilder(com.google.cloud.spanner.DatabaseId)
location: variable adminClient of type com.google.cloud.spanner.DatabaseAdminClient
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[61,30] cannot find symbol
symbol: variable EncryptionConfigs
location: class com.example.spanner.CreateDatabaseWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[64,9] method createDatabase in interface com.google.cloud.spanner.DatabaseAdminClient cannot be applied to given types;
required: java.lang.String,java.lang.String,java.lang.Iterable<java.lang.String>
found: com.google.cloud.spanner.Database,java.util.List<java.lang.String>
reason: actual and formal argument lists differ in length
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[85,26] cannot find symbol
symbol: method getEncryptionConfig()
location: variable createdDatabase of type com.google.cloud.spanner.Database
[INFO] 13 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.263 s
[INFO] Finished at: 2021-04-07T11:46:56-07:00
[INFO] Final Memory: 38M/224M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spanner-snippets: Compilation failure: Compilation failure:
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateBackupWithEncryptionKey.java:[30,43] package com.google.cloud.spanner.encryption does not exist
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[26,32] cannot find symbol
[ERROR] symbol: class Restore
[ERROR] location: package com.google.cloud.spanner
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[30,43] package com.google.cloud.spanner.encryption does not exist
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[28,43] package com.google.cloud.spanner.encryption does not exist
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateBackupWithEncryptionKey.java:[72,30] cannot find symbol
[ERROR] symbol: variable EncryptionConfigs
[ERROR] location: class com.example.spanner.CreateBackupWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[62,11] cannot find symbol
[ERROR] symbol: class Restore
[ERROR] location: class com.example.spanner.RestoreBackupWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[63,9] cannot find symbol
[ERROR] symbol: method newRestoreBuilder(com.google.cloud.spanner.BackupId,com.google.cloud.spanner.DatabaseId)
[ERROR] location: variable adminClient of type com.google.cloud.spanner.DatabaseAdminClient
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[66,30] cannot find symbol
[ERROR] symbol: variable EncryptionConfigs
[ERROR] location: class com.example.spanner.RestoreBackupWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/RestoreBackupWithEncryptionKey.java:[92,17] cannot find symbol
[ERROR] symbol: method getEncryptionConfig()
[ERROR] location: variable database of type com.google.cloud.spanner.Database
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[60,9] cannot find symbol
[ERROR] symbol: method newDatabaseBuilder(com.google.cloud.spanner.DatabaseId)
[ERROR] location: variable adminClient of type com.google.cloud.spanner.DatabaseAdminClient
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[61,30] cannot find symbol
[ERROR] symbol: variable EncryptionConfigs
[ERROR] location: class com.example.spanner.CreateDatabaseWithEncryptionKey
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[64,9] method createDatabase in interface com.google.cloud.spanner.DatabaseAdminClient cannot be applied to given types;
[ERROR] required: java.lang.String,java.lang.String,java.lang.Iterable<java.lang.String>
[ERROR] found: com.google.cloud.spanner.Database,java.util.List<java.lang.String>
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] /tmp/java-spanner/samples/snippets/src/main/java/com/example/spanner/CreateDatabaseWithEncryptionKey.java:[85,26] cannot find symbol
[ERROR] symbol: method getEncryptionConfig()
[ERROR] location: variable createdDatabase of type com.google.cloud.spanner.Database
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I followed the Getting started with Cloud Spanner in Java and did the following:
However, the compilation failed. Note that I did the same thing a while ago and it did work. So I guess this is caused by recent releases that include incompatible changes?
FYI, the errors are: