#Maven Gradle??

1 messages Β· Page 1 of 1 (latest)

clever rock
#

I have taken a long break from Java. Back in the day if you wanted to use a library you added the jar onto your class path and off you went. Now there's maven, and gradle, and I don't get it? Am I supposed to edit this xml to tell my build how to find external resources? Is there a tool that does this for me like pip install or something? Or do I need to learn one or both of these things?

runic schoonerBOT
#

<@&987246554085740594> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question πŸ€–. Maybe it helps! In any case, a human is on the way πŸ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

et it. Can someone explain the difference between Maven and Gradle and why I should use one over the other?

craggy notch
#

by default its supposed to look at ur local cache folder and at maven-central (some kind of official website to upload stuff to)

#

but u can also add other sites

#

jitpack is another important site, as it allows to automatically add anything from github directly

clever rock
#

okay so it's pulling those resources from the internet

craggy notch
#

yeah from maven central

#

or any "repository" that u defined in ur config

clever rock
#

thats pretty awesome

craggy notch
#

its ofc not as convenient as pip

#

but it goes in the same direction

#

and its also more than just for downloading deps

#

it can also automate other build steps

clever rock
#

eh whatever so long as I can figure it out. I saw this pom.xml thing and had some quick WTF's

craggy notch
#

such as "whenever i compile, i want u to do create javadoc, upload it to here, create a jar, upload it to there, do this and that and ..."

clever rock
#

I see so it's like a build script

#

like make

craggy notch
#

yeah all in one

clever rock
#

decent thanks

lapis sandal
clever rock
#

I'm kind of brave but, usually when someone says something like that it means I'm in for a ride

lapis sandal
#

you tell it the dependencies you want and it spits out a classpath

pearl gull
#

just use maven or gradle

#

itll be similar to having a package.json/cargo.toml/etc

snow igloo
#

(psst, use gradle, you write 5x more on maven for the same thing usually)

clever rock
lapis sandal
#
$ jresolve pkg:maven/org.apache.commons/[email protected]

/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/commons-codec/commons-codec/1.16.1/commons-codec-1.16.1.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/commons-io/commons-io/2.15.1/commons-io-2.15.1.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.14.0/commons-lang3-3.14.0.jar:/Users/emccue/.jresolve/cache/https/repo1.maven.org/maven2/org/apache/commons/commons-compress/1.26.1/commons-compress-1.26.1.jar

$ jresolve --output-directory libs pkg:maven/org.apache.commons/[email protected]
lapis sandal
lapis sandal
#

and I do think this is closer to what you remember, if you liked that

clever rock
#

yea I used to be a fan of it

#

I will consider trying it after I get the hang of one of these other ones

lapis sandal
cloud sky
lapis sandal
#

thats just a command running thing, pretty generic and not java specific

clever rock
#

why is gradle or maven better not trying to start a battle but, if there's a substantial difference I'd like to know

snow igloo
snow igloo
#

I'll let Ethan do the talking

lapis sandal
#

Maven is a "plugin execution engine"

#

you have an XML file and a set of tasks like mvn compile mvn test, etc.

cloud sky
lapis sandal
#

and when you run those, different plugins run

#

you can do any amount of logic within a plugin, but if you don't write a plugin yourself maven is generally inflexible

#

this is seen as a pro, since it means that it is harder to do exotic, wierd things

#

gradle is also a "plugin execution engine"

#

but you interface with it from a general purpose programming language (kotlin or groovy)

#

and it is easy to do any amount of logic, so gradle is very flexible

#

this is seen as a pro for the opposite reason you would like maven's inflexibility

#

so build scripts can contain a bunch of logic, but now there is a much higher chance that you mess it up

clever rock
#

interesting. it does seem like gradle has a lot more complexity, and if I'm trying to get my head around this for now I'd probably pick maven then

#

I want to learn groovy but not by failing to get packages to run πŸ˜„

snow igloo
# clever rock I want to learn groovy but not by failing to get packages to run πŸ˜„

Kotlin is probably more preferred because it's more "modern"
kotlin is used more as a JVM language than any other language (except of course, java which is obviously still more used than any other known JVM language easily)

doesn't mean you can't learn it, just saying kotlin could be a better scripting language or a better language in general πŸ™‚

#

maybe go for maven and don't worry about all of this for now

clever rock
#

thanks for the advice, yea maybe I will check out kotlin then

#

when it comes to JVM langauges, should I bother picking up Java or just ride along with Kotlin? I like having Scala as a side kick but so much has changed

lapis sandal
#

Java, Scala, Kotlin, Clojure, JRuby, Groovy

#

Groovy is a dead zone

#

no longer a java superset, mostly kept afloat by gradle

#

JRuby is its own universe. If you like ruby and the ruby world its there

#

Clojure is a lisp. It has an active community but it will always be small. I like it and had a job in it for 3 years but it is a niche pick

clever rock
#

ah yea I remember reading about clojure. Lisps are great but they have that curse in that they never get adopted 😦

lapis sandal
#

Scala was "Java++" in 2007, but now most of the really useful features from it are in Java or coming shortly

#

these days its mostly typed FP zealots obsessed with monads

#

and they have a Python2 -> 3 like thing going on with Scala 3

#

Kotlin is today's "Java++", but it also is cursed in that all of the really useful parts of it are in Java or coming in the future

clever rock
#

interesting, so maybe its more of a question of kotlin and java than anything else. Oh yea I remember some of that FP idealism back when I used it, I only liked it because it let me write cleaner Java. Which pissed off serious scala people to no end, but it was useful to me at the time

#

I see so Java is taking the C++ approach to language development

lapis sandal
#

and its bad features are gonna be around forever - like it has suspend fns for async/await when the runtime on the JDK doesn't need that anymore

#

so kotlin is now the king of android, but on the JVM its sorta...worse java

#

there are cool things, like it has null types in the type system

#

but even that is coming to Java in some form

#

(eventually)

#

so if you are making an android app or just something for fun - yeah kotlin is great

#

but it never really pulled me in, personally

clever rock
#

fair

#

I mostly stick to desktop

lapis sandal
clever rock
#

I take it java applets are dead too now that JS is ruler of all web things?

lapis sandal
#

these docs have kotlin and java samples

lapis sandal
clever rock
#

yea basically zero difference

#

wow well thanks for filling me in, its kind of hilarious

#

everything just went back to Java

snow igloo
#

rust compiles to wasm ;)