I've got a small little 24 lines of kotlin code th...
# announcements
g
I've got a small little 24 lines of kotlin code that just queries java to get properties like version. Yet for some reason the jar that gets produced is 35MB in size. At the same time, the actual intelliJ project is only 9KB in size... this cannot be right, I use only native packages no imports, simple code, WTF is going on here?
Copy code
package org.ppp.installer

object JavaGetProperty {
    @JvmStatic
    fun main(args: Array<String>) {
        try {
            val property = args.getOrNull(0)
            var propertyVal: String

            if (property == "java_patch") {
                //Custom Properties
                val fullVersion = System.getProperty("java.version", "unknown")
                propertyVal = fullVersion.split("_")[1]
            } else {
                //Direct Unprocessed Properties
                propertyVal = if (property != null) System.getProperty(property, "unknown") else "unknown"
            }

            print(propertyVal.trim())
        } catch (e: Exception) {
            print("unknown")
        }
    }
}
t
check what is inside jar, it is in the end just zip archive
g
Thank you, I did think to check that but opened it in notepad instead of 7zip, lol, still learning thanks. So here is what I see inside there. Note that my boss told me to isolate this code in separate project and I did that and then built an artifact that was only 3KB in size (much more reasonable and inline with expectations)... however, it isn't working for some reason I presume because it can't find kotlin stds....
second isolated project
t
seems you are adding to your jar unnecessary dependencies
g
thank you.... that makes sense... much appreciated!!!
I revised all this in a new project so I can understand it. At the moment it seems to be spitting out all of kotlin?? is that necessary or do I have something configured wrong?
t
if "org" is your package - then looks ok
g
it is... just wondering why I need all of kotlin for such a tiny function.
It's 4MB...
for a paragraph of code, lol
t
kotlin
contains standard library. You could remove it by either dependence on stdlib or use tools like proguard
g
thank you... you know your stuff.