aspose file tools
The moose likes Ant, Maven and Other Build Tools and the fly likes What's the right way to update your maven project in eclipse after a git pull Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "What Watch "What New topic
Author

What's the right way to update your maven project in eclipse after a git pull

Ben Synes
Ranch Hand

Joined: Jul 18, 2012
Posts: 54
Hi

I am fairly new to Eclipse, not a massive fan of it so far, as an IDE, but I want to try to like it, before I move to intelliJ.

So, can I ask, after doing a git pull, on the command line, whats the best way for me to update any new maven dependencies, refresh the project, and ensure its up to date.

It seems to me each time I get different results and have to re-run them a couple of times sometimes to see the updates, or even radically close and reopen the project.

Here is the typical routine I use:

1. Do a git pull
2. Refresh the project
3. Project -> clean
4. Maven -> Update project configuration
5. Maven -> Update project
6. In the project directory, mvn clean install -D skipTests

Look, Im fairly new to all of this, so this may well be completely wrong, more than likely its very wrong, I just want the correct minimal amount of steps to ensure my project in the IDE is showing the up to date artefacts, and dependecncies etc.

Sorry again, as a newbie, I hope this isnt too embarrassing a question, and I did google it before I posted it! But to no avail...
Ron Wheeler
Greenhorn

Joined: Mar 20, 2012
Posts: 8

As another person trying to learn about Git and Eclipse but a long time user of Eclipse (since 2007), I would suggest that you use the Spring Tools Suite.

It is Eclipse with all of the things that you need already configured.

We got so frustrated with Eclipse since:
1) it was a PITA to upgrade. You can spend days reconstructing a stable, compatible set of plug-ins to work with a new version of Eclipse.
2) when you tried to help another person on the team, it was hard to know how they worked since they might have a different set of plug-ins.
Operations that worked on your Eclipse would not work until you installed a plug-in on their machine.
3) hard to document standard procedures even informally.

STS comes ready to rock and roll out of the box in a single download and 5 minute install. It upgrades smoothly
It has all the plug-ins that you need for Maven, Git, SVN, XML and more.

I only have to install
1)the DITA-OT plug-in and add the XML Schema definition for DITA so that I can use Eclipse to produce documentation from XML topic files that I prepare using the Eclipse XML editor and validation tools.
2) the IzPack plug-in for building installers.

Once we moved to STS a lot of the annoying stuff about Eclipse vanished and we were able to standardize our collaboration processes and could stay reasonably current with Eclipse releases.

My only quibble is that it does have a big footprint but I would rather have everything that I need and a bit more rather than be missing a tool that I don't know exists or spend hours testing plug-ins to find one that will work with what I already have installed.

Since I use it for so many things - development(Java, JavaScript, JavaFX, Junit), deployment (IzPack), SCM (SVN and now Git), bugtracking (Bugzilla and JIRA integration) documentation(DITA), proposals and studies (DITA) - I have it on all the time and the convenience is worth the RAM that it takes.

The Maven integration (m2e) is very nice and eliminates a lot of the problems that show up in the Maven forum around dependency management (Why do I have the wrong version of X.X.X in my jar?).
We never use Maven from the command line.

STS is free and the quality is very high. The Spring guys do a good job putting out a release that works each time.

A little off topic but you seem to be having grief from the plain Eclipse product and I still remember the PITA that it can be.

Give STS a try before you spend some money on a commercial product. They may be better ( I hear good things from people that I respect) but perhaps with a better version of Eclipse, you can get what you need for free.
Ron Wheeler
Greenhorn

Joined: Mar 20, 2012
Posts: 8

Your workflow look correct and I am not sure why you are having unpredictable results.
Cleaning a project is an exceptional activity and should only be required occasionally.
Maven Clean is not usually required on each run but it is not a bad practice if you are seeing things that don't make sense.

Do you have m2e installed?
That gives you a good Maven environment.

Are you using a parent project for your modules that generate artifacts (jar, war)?
Dependency versions should be controlled in the dependency management section of the parent not in the pom of the modules (dependencies with no version specification there)
That way, you just change the parent and all your modules get the same version without changing the pom of each module. Less chance of error.

The Maven forum is a great place to get Maven help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What's the right way to update your maven project in eclipse after a git pull