6 ms·
Java is so much worse on this front. > with Java, you just dump the necessary jars into a directory, include them in the classpath, and it works. Ant, maven,
by the_gipsy 6y ago
Java is so much worse on this front.
> with Java, you just dump the necessary jars into a directory, include them in the classpath, and it works.
Ant, maven, or gradle, and then some jars, somewhere? What's the classpath and whats $JAVA_HOME for this project?
Oh and now I have to make it work in the IDE too, click through a billion menus and dialogs, sync the build system, sync the dependencies, configure runtimes and classpaths, try to rebuild for the 10th time, pray.
- jsiepkes 6y agoNobody has started a project with Ant in the last decade. Of all the Java projects on Github Ant is probably not even 1%. > Oh and now I have to make it work in the IDE too, click through a billion menus and dialogs, You click "Project from existing sources" in IntellIJ and it will recognize both Maven and Gradle projects and just work? Sync the dependencies? configure runtimes and classpaths? What? With Maven and Gradle? Your talking Ant here.
- matwood 6y agoI only had to go a few comments to see someone (the person you're responding to) think Java is the same as it was 15 years ago.
- the_gipsy 6y agoI'm talking about a maven project I have to use sometimes at work. Let me walk you through all the shit I had to do: - Install and set the right java version system-wide - Copy some config files for the project system-wide (granted, this is not java specific, but still) - Click in some IDE menu to enable some build settings - Click in some IDE menu to install some "Lombok" plugin - Click in some IDE menu to select the right jdk - Click in some IDE menu to edit the run configuration: - select main class - paste program args - paste env vars - select right “Use classpath of module:” option - Click in some IDE menu to fiddle with "Spring Loader path": modules, dependencies, reorder the dependencies (!) - Click in some IDE menu to configure getting the actual logs - Click maven-sync, rebuild-project multiple times, restart IDE until it suddenly works The first guy who got it to work had to write a guide with screenshots! I know you will say, this is all fault of whoever made this crap project, or my fault for not fixing it. However this was my experience, and it has been similar every time in my life that I had to touch some java project (although this last one is the worst).
- sixbrx 6y agoIDE's can be fiddly, and anyway I don't think it's good to depend on an IDE for building. The project could have been set up instead with the "Maven wrapper"(1) which provides "mvn.cmd/sh" scripts at the top level of the project to fetch and run the proper Maven. So after cloning the project, all you have to do is set a proper JAVA_HOME if it's not already set, and then do "./mvn clean package" at the top of the project to do a complete build. The IDE's will then set themselves up properly if you import the project as a Maven project, and will sync with changes to the Maven pom.xml whenever it changes (Intellij does at least). That's really hard to beat. (1) https://github.com/takari/maven-wrapper https://github.com/takari/maven-wrapper (Being integrated into Maven itself soon).
- the_gipsy 6y agoI can (and often do) build from CLI, that is much smoother. I tried using vim on java, but honestly you need an IDE for all the constant code generation and incessant fixups by mouseclicks that are needed. Vim+coc is more than enough in the other languages that I use.
- dboreham 6y agoYou're living in a parallel universe from the rest of us. IDE isn't necessary (and positively odd) for building Java.
- the_gipsy 6y agoYou do need to be able to build from IDE when you set breakpoints to debug.
- Hackbraten 6y agoYour IDE should be able to connect to any JVM that has been launched with the proper VM arguments. We occasionally do remote debugging at work. It’s just a matter of copy/pasting the correct JVM incantation into the IDE.
- fian 6y agoGuess I'm nobody. I created a simple Swing (desktop) app in Java a couple of weeks ago. The process was something like: Create new Java project in IDE Add no dependencies Use the built in IDE tooling to create a runnable JAR and tick the box to export the Ant build to a build.xml file. Why would I want to complicate things by adding Maven/Gradle to the mix?
- lolive 6y agoI will give you the secret trick of senior developers: don't be the one who manages the build process, otherwise leave the project asap. And I will also give you the secret trick of superninja senior developpers: be the one who manages the build process, so you will never EVER be fired.
- isbvhodnvemrwvn 6y agoThis method is useless for most projects, so yes, you are nobody.
- oblio 6y agoAnd what if you want/need to add dependencies? A lot of them.
- fian 6y agoSure _then_ you might opt to use Maven or Gradle. My point is there are a wide variety of application types out there, not everything is a web application, not everything needs to use a complex build and dependency management system.
- oblio 6y agoYeah, but if you do know Maven, it scales down to small projects. The configuration for a simple project is trivial. So just use Maven and save anyone coming after you a bunch of trouble when they have to extend your project ;-)
- stepbeek 6y ago
- ivan_gammel 6y agoWell, this could be true for some legacy projects with old tooling, but this is not how things work today. You install the IDE, checkout the code from Git and let IDE get a proper version of JDK for you and fetch dependencies from Maven central to local repo. You really should not copy jars anywhere or set environment variables.
- watwut 6y ago> Oh and now I have to make it work in the IDE too, click through a billion menus and dialogs, sync the build system, sync the dependencies, configure runtimes and classpaths, try to rebuild for the 10th time, pray. That is not my experience at all. I dont have to rebuild work project many times. Creating new scratch project for playing in is easy and fast. Dependencies are managed by maven and I rarely have to deal with that beyond added dependency tag.
- matsemann 6y agoHuh, as a consultant having touched many java code bases, they are all basically the same. Import the maven pom into intellij and run the main class. The folder structure, the code conventions etc are basically the same at every client and every project I've ever seen in java. All needed is having the correct version of Java, and maybe give maven a password so it can access private libraries. It's dead simple. And more importantly: it's the same everywhere.
- oblio 6y agoYeah, people under-estimate badly how useful the Maven conventions are, because they've never seen them in the C/Python/whatever world. I haven't used Maven in a bunch of years. But source code goes in src/main/java. Test code goes in src/test/java, resources (images, files, whatever) go in src/main/resources, test resources go in src/test/resources. There is a pom.xml file that contains dependencies, and if it doesn't, it points to a parent which <<does>> contain them. There might be submodules and they all are folders containing another pom.xml. That pom.xml generally points to the main pom.xml. Etc. There's a bit of tedium in there, but <<it's always the same>>! The level of consistency is something most ecosystems dream about. And you know what? That means that you can use your spare brain cells for actual creativity or hard work.
- bengalister 6y agoI have done 10+ years of Java development and 1 year of Python. And I disagree, Java packaging is better. You can package all your dependencies in a fat jar like Spring boot does and you only need to run it with java -jar lib.jar and you are good to go. Dependency management is a mess in the Python world and my number 1 complaint. You have pip, pipenv, poetry, anaconda, to manage your 3rd parties. And if you want to avoid conflicts and have consistent runtime you need to create a virtual environment to install these libraries and redownload everything. Otherwise libraries are installed user or system wide, in a directory that depends on the Python version that you use but they are not versioned there. With Maven you don´t have the issue. Your 3rd parties are downloaded in a global cache directory (the Maven repo) and are all versioned. For the delivery you can either provide them all and have the runner set the CLASSPATH or have them packaged into a single jar.
- the_gipsy 6y agoGreat, but you will actually want to write some code, so you have to do this insane IDE setup clickfest. I am not saying Python's packaging is any good, it sucks. But you can't realistically ignore Java's IDE shitshow.
- kaba0 6y agoIt’s pretty much an import project and done. If not, then someone really fcked up that build file.
- the_gipsy 6y agoBut this happened to me every time I had to use any java project over the years. Maybe I'm just unlucky.
- lenkite 6y agoPlease try OSS java projects and educate your build guy. Java the language may have lots of complaints but from the build/packaging point of view its actually one of the best languages out there. And very, very consistent.
- JAlexoid 6y agoI have no clue what you're talking about. Maven can build a nice fat executable jar, with just one XML block added to the pom. I've opened a 5year unmaintained project with IntelliJ yesterday - click package and got a working executable. I opened another project built with SBT... and guess what? No errors! Let's try that with a Python project (LOL!)