Skip to content

Commit

Permalink
fix(dependency): Issue of missing javax.validation, hibernate-validat…
Browse files Browse the repository at this point in the history
…or dependencies and version conflict of com.google.cloud:google-cloud-storage while upgrading the spring cloud to Hoxton.SR12 in kork. (#1119)

While upgrading spring cloud to Hoxton.SR12, we encountered below errors :

> Task :front50-core:compileJava FAILED
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:31: error: package javax.validation does not exist
import javax.validation.Valid;
                       ^
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:34: error: package org.hibernate.validator.constraints does not exist
import org.hibernate.validator.constraints.URL;
                                          ^
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:44: error: cannot find symbol
@Valid
 ^
  symbol: class Valid
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:108: error: package javax.validation.constraints does not exist
    @javax.validation.constraints.Pattern(regexp = VERSION_PATTERN)
                                 ^
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:60: error: cannot find symbol
  @Valid @nonnull private List<Release> releases = new ArrayList<>();
   ^
  symbol:   class Valid
  location: class PluginInfo
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:75: error: cannot find symbol
  @url private String homepage;
   ^
  symbol:   class URL
  location: class PluginInfo
/front50/front50-core/src/main/java/com/netflix/spinnaker/front50/model/plugins/PluginInfo.java:201: error: cannot find symbol
    @url String url;
     ^
  symbol:   class URL
  location: class Repository
7 errors

FAILURE: Build failed with an exception.

=======================

> Task :front50-gcs:compileTestKotlin FAILED
e: /front50/front50-gcs/src/test/kotlin/com/netflix/spinnaker/front50/model/FakeStorageRpc.kt: (52, 10): Class 'FakeStorageRpc' is not abstract and does not implement abstract member public abstract fun getCurrentUploadOffset(p0: String!): Long defined in com.google.cloud.storage.spi.v1.StorageRpc

FAILURE: Build failed with an exception.

The root cause is missing javax.validation:validation-api and hibernate-validator dependencies, the reason being upgrade of transitive dependency resilience4j from [1.0.0](https://mvnrepository.com/artifact/io.github.resilience4j/resilience4j-framework-common/1.0.0) to [1.7.0](https://mvnrepository.com/artifact/io.github.resilience4j/resilience4j-framework-common/1.7.0) while upgrade to Hoxton.SR12.

To fix this issue, we require to explicitly implement the dependency in gradle file of respective module.

The reason for front50-gcs:compileTestKotlin FAILED is version conflict of com.google.cloud:google-cloud-storage:1.113.6 (upgraded as transitive dependency in Hoxton.SR12) versus pinned version of 1.108.0 in front50-gcs.gradle.

To fix this issue, we require strict usage of old version google-cloud-storage (1.108.0) dependency by forcing it in gradle file.
  • Loading branch information
j-sandy committed Apr 18, 2022
1 parent 21554a3 commit 093b418
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions front50-core/front50-core.gradle
Expand Up @@ -26,6 +26,8 @@ dependencies {
implementation "io.reactivex:rxjava"
implementation "com.jakewharton.retrofit:retrofit1-okhttp3-client"
implementation "com.squareup.retrofit:converter-jackson"
implementation "javax.validation:validation-api"
implementation "org.hibernate.validator:hibernate-validator"
api "com.github.ben-manes.caffeine:guava"

api "io.spinnaker.kork:kork-plugins"
Expand Down
4 changes: 3 additions & 1 deletion front50-gcs/front50-gcs.gradle
Expand Up @@ -28,7 +28,9 @@ dependencies {
force=true
}
// TODO(plumpy): remove version once added to kork
implementation "com.google.cloud:google-cloud-storage:1.108.0"
implementation ("com.google.cloud:google-cloud-storage:1.108.0") {
force=true
}
implementation "com.google.guava:guava"
implementation "com.netflix.spectator:spectator-api"
implementation "io.spinnaker.kork:kork-exceptions"
Expand Down
1 change: 1 addition & 0 deletions front50-web/front50-web.gradle
Expand Up @@ -43,6 +43,7 @@ dependencies {
implementation "com.squareup.retrofit:converter-jackson"
implementation "io.swagger:swagger-annotations"
implementation "commons-codec:commons-codec"
implementation "javax.validation:validation-api"

runtimeOnly "io.spinnaker.kork:kork-runtime"

Expand Down

0 comments on commit 093b418

Please sign in to comment.