I've been programming PHP for 15 years and want to learn something new so I've decided to try to do some of my projects at work in Java. My boss doesn't care as long as it gets the job done.
I've managed to compile and run a few programs now but im curious how I should set up my projects and what frameworks and build tools etc to use (if any).
Here are a couple of projects that I want to do. I use the IntelliJ editor and the server which will host the programs has Java 8 runtime - and we are thinking of maybe installing Docker on the machine later for Spring projects.
- A cronjob will trigger a program that fetches files from an ftp server and injects the data into a mysql database.
- A program will convert image files to pdf files and notify users on slack and sms.
- Build a REST microservice which queries a database and returns data as json.
I know how to program the classes to do the actual work, but everything else I have no idea about. Like Maven - i guess it is like the php version of "composer". Is it overkill to use it for these small projects? Are there better alternatives? Should I use Spring Boot? What do modern Java programmers use?
When looking for libraries etc to do PDF processing and FTP stuff, where should I look - is there some "official" repo of quality and well documented libraries?
Maven might be overkill, however a small project is the best place to start to learn how these things fit together.
Taking the first one (the cronjob), there's maybe a handful of dependencies at best, and you'll probably only be needing an executable jar file at the end of it, that would actually (IMO) be a good thing to start with on Maven.
Not too many moving parts.
If you were to start with learning Maven on a larger project it would be quite easy to get lost. I know I do!
As for libraries, I tend to look at Apache first, and then it's whatever they happen to be using where I'm at.
Or a quick Google.
Or just ask here which, if nothing else, will generate a conversation about the different packages available for doing X.
Ant, Maven, Gradle, or something similar is something you'll almost definitely want to use. Java is an expensive language to work with. It has specific requirements on where things should be put while building - and in the products that you build. You can do it manually or via batch files (I did, back when single-celled animals inhabited the Java world), but it's painful, ugly and error-prone.
Build frameworks like Maven also have other advantages. I can ship a Maven project anywhere in the world and the person receiving it will not only know where to look for the various resources, but it will also pull in external resources automatically AND it will ensure that everything being pulled in is of known compatibility with the project. Before Maven, I literally couldn't build projects from another department in the same company because their desktop build environments and ours were too dissimilar.
Spring Boot isn't a builder, as such. It's a framework that allows you to create self-contained single-application webservers. Which is a surprisingly useful thing to have and even more so when you can containerize them with Docker or something similar.
Most of the time when I need a complex set of functions (library), I look at apache.org or codehaus. Or I look for Spring support. There are other places, such as tigris, but that's where I start.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
Cool, I think I'll have a look at Maven then as I heard the senior Java devs in the company use it. I don't wanna bother them with too noobish questions just yet so I guess I'll be posting a bit here with basic stuff while I get my feet wet