I tried to use `com.github.johnrengelman.shadow` b...
# announcements
l
I tried to use
com.github.johnrengelman.shadow
but failed to provide the main-class via
application
block
x
Copy code
tasks.withType<Jar> {
  baseName = project.name
  manifest.attributes.apply {
    put("Application-Name", project.name)
    put("Build-Date", ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_DATE_TIME))
    //put("Build-Number", )
    put("Created-By", System.getProperty("user.name"))
    put("Gradle-Version", gradle.gradleVersion)
    put("Implementation-Version", "${project.version}")
    put("JDK-Version", System.getProperty("java.version"))
    //put("Main-Class", mainClassName)
  }
  version = "${project.version}"
}
That's what I usually use; I have no custom/specific configs and/or settings. If you need those, you would need to tweak that...
p
Just use Maven.. why bother with this insane crap.
x
He is using Kotlin DSL...and like any other technology, it comes with pros and cons
p
by looking at the snippet I can't imagine the pros it would need to have to outweigh having to manually define your own freakin' manifest
x
You can actually skip that part 😊
l
Thanks @x80486 . I find use something similar and it works
yes Kotlin DSL has pros and cons but it's far from Maven Xml and not Gradle scripting. so It's the best tool so far. the cons it issue around other plugins and not able to copy-paste working example from other gradle projects
@poohbar the sum it up: autocompelte, write Kotlin co de(data class, Elvis operator,.. ) in your build file, less code, more readable, debug options
p
why would I want to have elvis operators and data classes in my build configuration for pete's sakes? there is enough applicatoin code in the.. you know.. application. I don't want to maintain more code just to compile some files and pack them into a jar
x
Basically, you prefer to have acres of XML, which is exactly what Maven offers 😂🤣...pace!
l
it’s actually less code.
e.g. most of the examples I find for default value(for dev vs prod) was including some like this:
Copy code
if(project.hasPorperty("db_url"){
project.get("db_url")
}else{   default val }
p
there is no "code" in maven.. nothing to be creative about.. you just declare what you need, there is one way to do most things, no infinitely complicated scripts that you have to maintain over time
also, gradle integration in intellij is much worse than maven integration.. multimodule projects are awful in gradle and there is no integration test phase by default.. seriously.. what a garbage
l
and what if you need a custom script?
like flyway? or deployment stuff?
you will write maven module for it?
don’t get me wrong, I used maven for lot of year and it was great progress(from Ant). but personally Gradle do the same job and better (IMO)