Skip to content

Commit

Permalink
IHP-5 - fix ClassNotFoundException from sbt-assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisNovac committed Feb 4, 2024
1 parent 56d8699 commit 9ffeb5e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
7 changes: 6 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ val assemblyStrategy = assembly / assemblyMergeStrategy := {
case PathList("META-INF", "maven", "org.webjars", "swagger-ui", "pom.properties") =>
MergeStrategy.singleOrError

// lot of metainf folders might override this project's metainf which will result in error:
// Could not find or load main class com.github.baklanovsoft.imagehosting.resizer.Main

case PathList("META-INF", xs @ _*) => MergeStrategy.discard

// deduplicate error because of logback, this will fix
case x =>
case x =>
MergeStrategy.first
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.baklanovsoft.imagehosting.imagehosting.kafka
package com.github.baklanovsoft.imagehosting.kafka

import cats.implicits._
import cats.effect.kernel.{Async, Resource}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.baklanovsoft.imagehosting.imagehosting.kafka
package com.github.baklanovsoft.imagehosting.kafka

import cats.effect.kernel.Sync
import cats.implicits._
import com.github.baklanovsoft.imagehosting.error.DecodingError
import com.github.baklanovsoft.imagehosting.imagehosting.kafka.KafkaJsonDeserializer.KafkaJsonDecodingError
import KafkaJsonDeserializer.KafkaJsonDecodingError
import fs2.kafka._
import io.circe.Decoder
import io.circe.jawn.decodeByteArray
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.baklanovsoft.imagehosting.imagehosting.s3
package com.github.baklanovsoft.imagehosting.s3

import cats.effect.kernel.Sync
import io.minio.{MakeBucketArgs, MinioClient => MinioClientJava, PutObjectArgs, RemoveBucketArgs}
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
container_name: resizer1
depends_on:
- kafka-init
- minio
environment:
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
CONSUMER_GROUP_ID: resizer-local-test
Expand Down Expand Up @@ -88,10 +89,10 @@ services:
- "9000:9000"
- "9001:9001"
volumes:
- images-data:/data
- minio-data:/data
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin

volumes:
images-data:
minio-data:
3 changes: 1 addition & 2 deletions resizer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM eclipse-temurin:17.0.6_10-jre-jammy

WORKDIR /opt/app

#COPY ./application.conf ./app/target/scala-2.13/image-hosting-processing-resizer-assembly-0.1.0-SNAPSHOT.jar ./
COPY ./target/scala-2.13/image-hosting-processing-resizer-assembly-0.1.0-SNAPSHOT.jar ./

ENTRYPOINT ["java", "-cp", "image-hosting-processing-resizer-assembly-0.1.0-SNAPSHOT.jar", "com.github.baklanovsoft.imagehosting.resizer.Main"]
ENTRYPOINT ["java", "-cp", "image-hosting-processing-resizer-assembly-0.1.0-SNAPSHOT.jar", "com.github.baklanovsoft.imagehosting.resizer.Main"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.github.baklanovsoft.imagehosting.resizer

import cats.effect.{ExitCode, IO, IOApp}
import com.github.baklanovsoft.imagehosting.NewImage
import com.github.baklanovsoft.imagehosting.imagehosting.kafka.{KafkaConsumer, KafkaJsonDeserializer}
import com.github.baklanovsoft.imagehosting.imagehosting.s3.MinioClient
import com.github.baklanovsoft.imagehosting.kafka.{KafkaConsumer, KafkaJsonDeserializer}
import com.github.baklanovsoft.imagehosting.s3.MinioClient
import fs2.kafka.commitBatchWithin
import org.typelevel.log4cats.LoggerFactory
import org.typelevel.log4cats.slf4j.Slf4jFactory
Expand Down

0 comments on commit 9ffeb5e

Please sign in to comment.