Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse Usage (Java EE and Spring Framework related)(Eclipse Usage (Java EE and Spring Framework related) - build related)
Eclipse Usage (Java EE and Spring Framework related) [message #1318374] Sun, 27 April 2014 16:33 Go to next message
Moe B is currently offline Moe BFriend
Messages: 8
Registered: April 2014
Junior Member
Ok this is long and has many stupid questions, because I am a dumb beginner.

Im a single developer working on a project (Java Web App) and I am relatively new to Java. I am even newer to the Spring framework. I have managed to write a small project that uses one servlet and some jsp's to authenticate users against a database and route them to either a welcome page or an error page based on login credentials. I have gotten to this point but it is only the beginning of what this application will do ofcourse. Most importantly, I am not using any Spring.

I understand that it is in my interest to learn the spring framework if I am to design Java EE enterprise applications because it makes many things easier. So, in that quest, I headed over to the tutorials on the spring website in order to do some learning. I relized quickly that all of their examples include a Maven or Gradle script for dependencies and for build. So, I thought oh no now I have to learn about one of these build tools if I need to use Spring framework? So, with my limited knowledge and reading around, I picked Gradle when I started understanding that it is the latest generation build tool in the line of Ant->Maven->Gradle. So, I thought Gradle is what I should invest my time in.

Anyway, when I started to work on the Spring tutorial above, I quickly realized that they are doing this at the command line and not on an IDE. That confused me even further because I thought why would anyone used command line in todays world full of capable IDEs. I had Eclipse (plain vanilla + Spring Tool Suite) installed already so I thought I will do this on Eclipse instead. That's where my confusion skyrocketed.

For starters, I couldn't figure out what kind of project template to start with. Should it be a "Dynamic Web Project?" No wait it has to be some kind of a Spring template right? Otherwise why would I go through the trouble of adding the Spring Tool Suite and get all these new templates? Ok, so I picked a Spring template. I quickly realized that I also have the option to import the Spring MVC tutorial that I was doing into Eclipse. So, I did that. More confusion, now I realized that if I right click on the imported example project, there is no longer a "Run on server" option in the "Run as" menu. I thought why is that gone? I must have picked the wrong project template. But wait, I couldn't have picked the wrong template because I imported the whole project from the Spring website. Oh man my head hurts. After some thinking I remembered.....oh yes they talked about Gradle and I already downloaded it and set my Path environment variable for it so I'll use Gradle to build and run this project. Ok now how do I invoke Gradle from within Elipse? More reading told me I must have Eclipse Gradle Integration. So I downloaded that plugin into eclipse. Now, in my right click menu I have a "Gradle" and "Gradle..." option but still no "Run on server". Man, why is this so complicated I am a beginner simply trying to run a tutorial Spring MVC project. Anyway, I chose "Gradle" from the "run as" option and I saw that Gradle prints out a bunch of a stuff in the Eclipse console like when its starting the embedded servlet container and other good stuff. But I see nothing else happening. I expected the Eclipse embedded web browser to show me "Hello world". But wait this isn't a web project because there is no Web-Inf folder in its hierarchy, so why would I see a browser...okay but I also don't see "hello world" in the console? Where is the project running? Ahaha..finally I launched my own Chrome browser and pointed it to localhost URL and glory, I saw "hello world".

It took me two and a half days of playing around to figure all out up to this point. As you can see, my understanding is in its infancy on these things and I need some questions answered. If am looking to build a Java web application and I am the only developer:

1. Do I need a build tool? I thought this was for teams.
2. If so, is Gradle ok?
3. Which Eclipse template to start with?
4. Some other Spring MVC tutorials I saw online like the one from tutorialspoint do include jsp's and are web based(and not simply command line). Those tutorials ask you to import some jars(Spring and related jars like commons-logging) into the project at some point. How do these guys know which of the spring jars they need? Is it from experience or is there another source for this knowledge? I thought this dependency management is where the whole need for the build tool comes in and that's what Gradle will handle for me, nevermind I don't know how to ask Gradle to do that yet.
5. Once I start a project and start using Spring incrementally, how do I know what additional jars I need at certain points?

Thanks for reading until this line and thanks for your help.
Re: Eclipse Usage (Java EE and Spring Framework related) [message #1319117 is a reply to message #1318374] Mon, 28 April 2014 02:35 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 04/27/2014 01:37 PM, Moe B wrote:
> Ok this is long and has many stupid questions, because I am a dumb
> beginner.
>
> [snip]
>
> 1. Do I need a build tool? I thought this was for teams.
> 2. If so, is Gradle ok?
> 3. Which Eclipse template to start with?
> 4. Some other Spring MVC tutorials I saw online like the one from
> tutorialspoint do include jsp's and are web based(and not simply command
> line). Those tutorials ask you to import some jars(Spring and related
> jars like commons-logging) into the project at some point. How do these
> guys know which of the spring jars they need? Is it from experience or
> is there another source for this knowledge? I thought this dependency
> management is where the whole need for the build tool comes in and
> that's what Gradle will handle for me, nevermind I don't know how to ask
> Gradle to do that yet.
> 5. Once I start a project and start using Spring incrementally, how do I
> know what additional jars I need at certain points?
>
> Thanks for reading until this line and thanks for your help.

You'll get as many answers to this as you get people motivated enough to
respond.

I would say that if you're on the beginning side, don't get involved in
complex tools and frameworks just yet. It takes a long time to "grow up"
when you're dealing with stuff like that which will obfuscate a lot of
what's going on.

Spring began as a lightweight framework, but like most mature tools,
it's flooded its banks and become a behemoth. In my opinion, if you're
going to write a heavyweight, complex application, by all means, sell
your soul to Spring. It's got really cool stuff to help you do many
things in the best ways, but at the same time, it's hard to debug
especially if you didn't "grow up" in what's going on before you adopted it.

JSPs are really, really simple. You don't need Maven, Gradle, Spring or
any of the heavy stuff to get started. Here are two links to tutorials
that do JSP. There are too many more than I can count. I wrote the first
one at a time when I wanted to make sure I left nothing out for the new
guy. Lars Vogel's tutorials, however, are absolutely first rate. Neither
will take you much time.

http://www.javahotchocolate.com/wtp-tutorials/wtp-tutorial.html
http://www.vogella.com/tutorials/EclipseWTP/article.html

JSPs are also ancient technology. It's hard to imagine doing anything
real in JSP for a lot of reasons I won't go into. However, it's a really
good way to begin to grok servlets and the web application architecture
because it doesn't obfuscate too much.

To answer your direct questions...

1. It's true that build tools are very helpful for teams, but they are
also helpful for individuals. I don't know how far, how fast you intend
to go. If you've got the time, I would say let Eclipse build your
project for now. Later, when you decide you need more, learn ant. Then
move on to Ivy or Maven.

You'll find that most of the libraries you begin to need to develop
anything are expressed in terms of Maven. It becomes increasingly
difficult, especially for a beginner, to figure out how to get the JARs
you need to do your application. (Not the case of the tutorials above.)

I prefer ant and Ivy, but Maven's simply hugely adopted. You can't
ignore it because of how universal it is. I'll say nothing of Gradle as
I haven't used it. I've heard good things about it.

2. Maven is quasi-universal. Gradle is more recent. Between the two it's
mostly religious zeal. I've yet to stumble upon any tutorial that uses
Gradle; they all like to use Maven.

3. By template, I assume you're speaking of what Maven calls an
archetype (maybe Gradle has templates). Eclipse Maven extensions come
with pre-made archetypes. A JSP is a web application. Web applications
are done in Eclipse using the Eclipse Dynamic Web Project. You'll find
archetypes for that in Maven.

Learning a tool such as Gradle or Maven is going to consume a lot of
cycles. It depends on whether you're here to learn Java, web
applications, accomplish something, etc. or learn tools. It's pretty
long and painful. Good thing there's a web, Google, stackoverflow.com,
eclipse.org, etc.

4. The thing about Spring any more is that it's devilishly hard to
include one Spring JAR without the others. You can get Maven pom.xml
files ready made to include what Spring you need. I assume that the same
is true for Gradle.

5. Typically as you learn you need JARs, you'll learn also which ones
and specifying the dependency is very easy in Maven. At first it will
seem somewhat mysterious, but as you go, it becomes second nature.

I hope you get other opinions here; it's all religion tempered with good
advice. How to tell which is which?

Good luck. I hope this is more useful than counter-productive.

Cheers
Re: Eclipse Usage (Java EE and Spring Framework related) [message #1319816 is a reply to message #1319117] Mon, 28 April 2014 12:03 Go to previous messageGo to next message
Moe B is currently offline Moe BFriend
Messages: 8
Registered: April 2014
Junior Member
I wasn't expecting any responses given how verbose and newbish my post was. I am glad not only to receive a response but such a detailed and thorough one which has hit every concern I raised. Thanks so much for the awesome info. You mentioned jsp's being an older technology. What are some of the newer counterpart(s) to it?

thanks again.
Re: Eclipse Usage (Java EE and Spring Framework related) [message #1322504 is a reply to message #1319816] Tue, 29 April 2014 22:13 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 04/28/2014 06:03 AM, Moe B wrote:
> I wasn't expecting any responses given how verbose and newbish my post
> was. I am glad not only to receive a response but such a detailed and
> thorough one which has hit every concern I raised. Thanks so much for
> the awesome info. You mentioned jsp's being an older technology. What
> are some of the newer counterpart(s) to it?
>
> thanks again.

It depends on what you're doing.

JSF came in 2004 to solve the problems JSP has with MVC and exposing
business logic and private details. Since then there have been too many
to name (stuff like Seam, Struts2, Spring) and JSF has been
substantially enhanced and upgraded.

If I were pushing ahead--I don't often do UX/UI stuff, but only
back-end--I would use JSF with JavaScript and AJAX, but that really
because it's what I'm acquainted with. Here's a link to an article I
recently read with some interest:

http://www.beyondjava.net/blog/angularfaces-jsf-beyond-ajax/

Or I'd consider using Apache Wicket. It's very good, but a steep, upward
hill to climb.

Best of luck,

Russ
Re: Eclipse Usage (Java EE and Spring Framework related) [message #1324066 is a reply to message #1322504] Wed, 30 April 2014 15:44 Go to previous message
Moe B is currently offline Moe BFriend
Messages: 8
Registered: April 2014
Junior Member
Awsome. Thanks so much.
Previous Topic:Eclipse close when I try to use a png file in .ui
Next Topic:Switch between xml pages with button click
Goto Forum:
  


Current Time: Sat Oct 31 14:21:59 GMT 2020

Powered by FUDForum. Page generated in 0.04535 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top