• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Should I use a framework/build tools etc?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
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.
etc

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?
 
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 77953
373
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . .  and welcome to the Ranch
 
Bartender
Posts: 7494
171
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carl Anton wrote:When looking for libraries etc to do PDF processing and FTP stuff


As to these two in particular, perhaps the most commonly used FTP client code is Apache Commons Net. For PDF generation, check out Apache PDFBox (code example).
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using IntelliJ IDEA, you might want to use Gradle as your build program.  I'm a big fan of Maven, but Gradle is built in to IntelliJ.  I'm sure you could get a plugin for Maven though.
 
Saloon Keeper
Posts: 26894
192
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Carl Anton
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a forum specifically for that: Ant, Maven and Other Build Tools.

https://coderanch.com/f/67/tools
 
Saloon Keeper
Posts: 14857
334
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please take some time to read about the Maven build lifecycle, and also the Maven POM reference. Bookmark them, because they are great resources to come back to as you experiment with Maven.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And, of course, the Maven website: https://maven.apache.org/users/index.html
reply
    Bookmark Topic Watch Topic
  • New Topic