Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Sunday, September 9, 2012

A trick to help with the Eclipse update blues

I think anyone who uses Eclipse has cussed at the software installer/updater/marketplace.  Tonight I tried to install the eGit plugin from the marketplace with no luck.  As usual, every time it tried to download something from download.eclipse.org, usually content.jar, it would hang until the 600s network timeout elapsed.

I did a little googling and stumbled upon a JVM setting that fixed the problem in this instance.  Crack open the eclipse.ini and throw this parameter into the -vmargs:

-Djava.net.preferIPv4Stack=true

After doing that the updates worked great.  All the network communication went by quickly on my cable modem and I wasn't sitting there wondering what the hell Eclipse is doing.  I can live with slow downloads when I can see progress going by but the 10 minute hangs with no feedback...

For what it's worth, the other trick I saw that people found helpful was to go to the 'Install New Software' screen and uncheck the 'Contact all update sites during install to find required software' check box.  That didn't help my issue, the JVM parameter is what did the trick there, but it's worth keeping in mind if updates are mis-behaving.

Any who, maybe this will help someone else out with Eclipse downloads.

Sunday, February 5, 2012

Git, Eclipse and Maven multi-module project

More adventures in maven (sometimes I wonder how worth it is with maven), git and Eclipse...

So I have a multi-module maven project I'm working on, something of prototype to use for future reference for Maven managed EAR projects, and I'm using git for version control. I'm used to using SVN in Eclipse (via Subclipse) and CVS of course, unfortunately, but git's a little different. After some experimentation I think I've got things setup so that

A) the parent and each of the sub projects are connected to the same working git repo within Eclipse and
B) the Eclipse project settings are all managed by maven & the m2e plugins so that none of the Eclipse files (or dependency jars! ;) are checked into source control.

No real need there on that second point, just a preference since maven is so uber magically cool (</sarcasm>) and it handles all the gnarlly Eclipse project set up for you. If you like using other editors, this way you don't have all the Eclipse trash to deal with when you check the project out. Plus I like to hurt myself sometimes proving maven can do it a couple of times a year. Usually after a weekend, like this one, I have things worked out and it is actually pretty cool.
So when it comes to version control, to get everything set up and working using git I am doing the following:

  • Clone the project into my active workspace, either by command line or via the Eclipse egit wizards.
  • Import the existing maven projects into my workspace
  • Connect each of the imported projects to the git repo I'm working out it by right clicking on the project and choosing Team > Share Project > selecting Git then finally checking the "Use or create repository in the parent folder" check box. This can be done in bulk by selecting multiple projects

  • Now I have my nice snazzy maven/m2e managed multi-module project and all the flexible goodnes that comes with it, at least twice as much as needed to hang my self multiple times a day for a year, connected to git so I can check things in locally and forget to push the changes up to the bare repo I cloned from ; ) Good times.

    Thursday, November 17, 2011

    tools of the trade

    Handy commands and shortcuts for folks who develop (Java) software for a living.

    *nix
    grep
    cat
    less
    more
    sort
    uniq
    sed
    awk
    wc
    ls

    All of these are bread-and-butter commands that when chained together allow you to get a lot of ad-hoc stuff done.

    eclipse
    - Alt-Shift-R - refactor for the var/method underneath the cursor
    - Alt-Shift-X - run command short cuts to run tests, apps, etc quickly
    - Ctrl-F7 - to cycle views
    - Ctrl-F8 - to cycle perspectives
    - the debugger's Display view which allows you to run Java expressions within the scope/context of the break-point the debugger is currently stopped at.
    - conditional breakpoints: right click on the break point or select it in the breakpoint list, check the Conditional check box and enter the Java expression that will pause the execution when it evaluates to true.  this is a MUST for mutli-threaded development!
    - Open Call Hierarchy: right click on a method and use this to see where in your code this method is being called.  I've found this to be very helpful when I'm working on a class that is used in multiple projects (currently open in the workspace of course).

    maven
    mvn dependency:tree -Dverbose
    - shows a very helpful graph of defined and transitive dependencies (as maven sees them)

    mvn versions:display-dependency-updates
    - shows you which dependencies defined in your pom have updated versions.

    mvn versions:display-plugin-updates
    - same thing as the dependency flavor but for all the plugins configured in your poms.

    misc.
    - log4j configurations got you down? Put this JVM command line option in place to make log4j spit out lots of good debugging information: -Dlog4j.debug
    - if you find yourself commenting a block of code, consider that you might actually need a function/method. (not sure who said it first but heard it in a code review and wanted to write it down ; )