Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8007535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:51:39+00:00 2026-06-04T17:51:39+00:00

I’m using xsbt-proguard-plugin , which is an SBT plugin for working with Proguard. I’m

  • 0

I’m using xsbt-proguard-plugin, which is an SBT plugin for working with Proguard.

I’m trying to come up with a Proguard configuration for a Hive Deserializer I’ve written, which has the following dependencies:

// project/Dependencies.scala
val hadoop      = "org.apache.hadoop"          %  "hadoop-core"          % V.hadoop
val hive        = "org.apache.hive"            %  "hive-common"          % V.hive
val serde       = "org.apache.hive"            %  "hive-serde"           % V.hive
val httpClient  = "org.apache.httpcomponents"  %  "httpclient"           % V.http 
val logging     = "commons-logging"            %  "commons-logging"      % V.logging
val specs2      = "org.specs2"                 %% "specs2"               % V.specs2      % "test"

Plus an unmanaged dependency:

// lib/UserAgentUtils-1.6.jar

Because most of these are either for local unit testing or are available within a Hadoop/Hive environment anyway, I want my minified jarfile to only include:

  • The Java classes SnowPlowEventDeserializer.class and SnowPlowEventStruct.class
  • org.apache.httpcomponents.httpclient
  • commons-logging
  • lib/UserAgentUtils-1.6.jar

But I’m really struggling to get the syntax right. Should I start from a whitelist of classes I want to keep, or explicitly filter out the Hadoop/Hive/Serde/Specs2 libraries? I’m aware of this SO question but it doesn’t seem to apply here.

If I initially try the whitelist approach:

// Should be equivalent to sbt> package
import ProguardPlugin._
lazy val proguard = proguardSettings ++ Seq(
  proguardLibraryJars := Nil,
  proguardOptions := Seq(
    "-keepattributes *Annotation*,EnclosingMethod",
    "-dontskipnonpubliclibraryclassmembers",
    "-dontoptimize",
    "-dontshrink",
    "-keep class com.snowplowanalytics.snowplow.hadoop.hive.SnowPlowEventDeserializer",
    "-keep class com.snowplowanalytics.snowplow.hadoop.hive.SnowPlowEventStruct"
  )
)

Then I get a Hadoop processing error, so clearly Proguard is still trying to bundle Hadoop:

proguard: java.lang.IllegalArgumentException: Can't find common super class of [[Lorg/apache/hadoop/fs/FileStatus;] and [[Lorg/apache/hadoop/fs/s3/Block;]

Meanwhile if I try Proguard’s filtering syntax to build up the blacklist of libraries I don’t want to include:

import ProguardPlugin._
lazy val proguard = proguardSettings ++ Seq(
  proguardLibraryJars := Nil,
  proguardOptions := Seq(
    "-keepattributes *Annotation*,EnclosingMethod",
    "-dontskipnonpubliclibraryclassmembers",
    "-dontoptimize",
    "-dontshrink",
    "-injars  !*hadoop*.jar"
  )
)

Then this doesn’t seem to work either:

proguard: java.io.IOException: Can't read [/home/dev/snowplow-log-deserializers/!*hadoop*.jar] (No such file or directory)

Any help greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:51:41+00:00Added an answer on June 4, 2026 at 5:51 pm

    In the end, I couldn’t get past duplicate class errors using Proguard, let alone how to figure out how to filter out the relevant jars, so finally switched to a much cleaner sbt-assembly approach:

    -1. Added the sbt-assembly plugin to my project as per the README

    -2. Updated the appropriate project dependencies with a "provided" flag to stop them being added into my fat jar:

    val hadoop      = "org.apache.hadoop"          %  "hadoop-core"          % V.hadoop      % "provided"
    val hive        = "org.apache.hive"            %  "hive-common"          % V.hive        % "provided"
    val serde       = "org.apache.hive"            %  "hive-serde"           % V.hive        % "provided"
    val httpClient  = "org.apache.httpcomponents"  %  "httpclient"           % V.http
    val httpCore    = "org.apache.httpcomponents"  %  "httpcore"             % V.http  
    val logging     = "commons-logging"            %  "commons-logging"      % V.logging     % "provided"
    val specs2      = "org.specs2"                 %% "specs2"               % V.specs2      % "test"
    

    -3. Added an sbt-assembly configuration like so:

    import sbtassembly.Plugin._
    import AssemblyKeys._
    lazy val sbtAssemblySettings = assemblySettings ++ Seq(
      assembleArtifact in packageScala := false,
      jarName in assembly <<= (name, version) { (name, version) => name + "-" + version + ".jar" },
      mergeStrategy in assembly <<= (mergeStrategy in assembly) {
        (old) => {
          case "META-INF/NOTICE.txt" => MergeStrategy.discard
          case "META-INF/LICENSE.txt" => MergeStrategy.discard
          case x => old(x)
        }
      }
    )
    

    Then typing assembly produced a “fat jar” with just the packages I needed in it, including the unmanaged dependency and excluding Hadoop/Hive etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.