How to resolve Maven’s “Failure to Transfer” error

Here is a quick solution for those encountering the “Failure to Transfer” error in Maven.
The error message will most likely look something like this


Failure to transfer <DEPENDENCY> from <REPOSITORY>
was cached in the local repository, resolution will not be reattempted until 
the update interval of central has elapsed or updates are forced.

This is a documented issue in Maven’s jira page.

When an artifact is unable to be downloaded, Maven 3 caches this result for future reference in the “~/.m2/repo/…/<artifact>.lastUpdated” file. For “not found” situations, it seems that the HTTP code could be used to more granularly re-attempt retrieval rather than just cache the failure.

For example, for any 404, I agree, the result should cache the failure and require a -U to attempt to retrieve it again. However, for 400, 500, 501, 502, 503, 301, 302 (what’s the Maven behavior for 3xx today?) I think the resolution engine should try to re-retrieve the artifact each time. With those error codes, it seems more likely a config issue or brief network hiccup, not one of the file being absent from that repo. However, that brief network hiccup has longstanding cache implications in that the file is never attempted to be retrieved again.

The easiest way to resolve this is to delete the dependencies or artifacts which maven has appended with the  .lastUpdated prefix.  Only after that can you successfully Update Dependencies of your maven project.
But deleting all these artifacts from your maven repository one by one every time this occurs is not an ideal solution.
The most simple solution is suggested by Jonas Anderson in Stackoverflow.

For Unix Users

  1. find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
  2. Right click your project and choose Update Dependencies

For Windows

  1. CD (change directory) to
    <user-directory>\.m2\repository
  2. execute this command
    for /r %i in (*.lastUpdated) do del %i
  3. Right click your project and choose Update Dependencies

Toad for Eclipse Plugin

You might not be aware, but there is a Toad plugin for Eclipse.  Yes Toad, (kokak) the world’s  favorite Tool for Oracle Application Developers.  This plugin is created by Quest Software themselves and is available as a FREE download from the Eclipse Market Place and from Quest Software http://www.quest.com/toad-extension-for-eclipse/

The Toad Extension for Eclipse plugin allows you to connect to your Oracle or PostgreSQL database from within Eclipse.  All you need to do is to switch into the Toad Extension perspective.  From the Toad Extension perspective you can easily browse data, develop complex PL/SQL and even edit data without the need of opening a separate IDE like Oracle SQL Developer.

TOAD EXTENSION FOR ECLIPSE FEATURES

Connections View   Displays configured database connections  
Schema Browser   Browses through schema objects  
Object Describe   Views detailed information about an object  
SQL Worksheet   Edits and executes SQL statements  
Projects and Toad Extension for Eclipse Nature   Adds additional functionality to new or existing projects  
Syntax Check   Verifies SQL code on-the-fly  
Deployment   Allows to deploy objects to database using default connection or selected connection  
Object status   Shows status of object in default database  
Export to HTML/XML/CSV   Outputs data to selected format  
SQL Recall   Views a history of your executed SQL statements  
SQL Monitor   Monitors all SQL coming from Toad Extensions  
DBMS Output View*   Views DBMS_OUTPUT results  
Stored Procedure Editor   Edits Stored Procedures, Views and Triggers  
Search dialog   Searches through database source code  
PL/Doc View*   Views column information comments  
Outline View   Views the logical structure of a database object  
Sessions View*   Monitors or kills sessions in the database  
Parameters View* Displays an overview of the database and session parameters

Quotes Every Software Engineer Should Know

There are 10 people in the world, those who can read BINARY and those who cannot.

- Anonymous

A clever person solves a problem.

A wise person AVOIDS it.

- Albert Einstein

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

- Rich Cook

Before software can be reusable it first has to be usable.

- Ralph Johnson

There’s no time to stop for gas, we’re already late

- Karin Donker

To go faster, slow down. Everybody who knows about orbital mechanics understands that.

- Scott Cherf

On the radio the other night, Jimmy Connors said the best advice he ever got was from Bobby Riggs:

* do it

* do it right

* do it right now

It is not enough to do your best: you must KNOW what to do, and THEN do your best.

- W.Edwards Deming

Abraham Lincoln reportedly said that, given eight hours to chop down a tree, he’d spend six sharpenning his axe.

- TidBITS 654, quoted by Derek K. Miller, via Art Evans

Everybody Knows:

* Discipline is the best tool.

* Design first, then code.

* Don’t patch bugs out, rewrite them out.

* Don’t test bugs out, DESIGN them out.

The significant problems we face cannot be solved by the same level of thinking that created them.

- Albert Einstein

When somebody begins a sentence with “IT WOULD BE NICE IF..” the right thing to do is to wait politely for the speaker to finish. No project ever gets around to the it-would-be-nice features: or if they do, they regret it. Wait for sentences that begin “WE HAVE TO..” and pay close attention, and see if you agree.

- Tom Van Vleck

Why do we never have time to do it right, but always have time to DO IT OVER?

- Anonymous

It’s hard enough to find an error in your code when you’re looking for it; its even harder when you’ve ASSUMED your code is ERROR-FREE.

- Steve McConnell

Simple things should be simple, complex things should be POSSIBLE.

The perfect project plan is POSSIBLE if one first documents a list of ALL the UNKNOWNS.

- Bill Langley

Software and cathedrals are much the same – first we build them, then we pray.

FAST. GOOD. CHEAP. Choose any two.

- Common Project Scheduling Mantra

Adding manpower to a late software project makes it later.

- Fred Brooks

9 women CANNOT make a baby in ONE MONTH.

- Fred Brooks


Eclipse Indigo Is Here!!!

Sorry if I’m 35 days late in announcing this but I felt a great sense of responsibility of testing Indigo first so that I can provide useful and reliable comments.   (Nah I was just busy with my day job).  Indigo is the annual release of Eclipse projects and was released last June 22, 2011.

Below I’ll try to comment on the top new features added to Indigo as mentioned on their site and based on my experience using Eclipse.

Highlights:

  1.  EGit 1.0 provides tight integration with the Git version control system.
    Unless you have been living under a rock for the past 5-6 years you should be familiar with Git.  Git is a very popular and powerful version control system, the development of Git was lead by no other than Linus Torvalds himself which is best known for having initiated the development of the Linux kernel.  Having support for Git is like a 13th month pay bonus for Eclipse users which uses Git for their version control.   Eclipse has supported CVS and Subversion for as far as I can remember, all I can say is ITS ABOUT TIME.”
  2. WindowBuilder, a popular GUI builder for Eclipse developers, is now open source and part of Indigo.
    Yes your eyes is not playing tricks on you it is now opensource and yes it is now part of Eclipse starting with this release.  For those GUI developers which is still not using WindowBuilder go check it out and thank me later actually thank the opensource community.  Yes it supports Swing code generation.  Yes it supports SWT code generation. Yes it supports GWT code generation it is a super GUI designer.  Yes you can now spend more time with your family and less time creating complex forms and yes there is a God thank him too for creating unselfish people and organizations which supported this project.
  3. Better integration with Maven, including starting Maven builds and maintaining pom files.
    Since this is all about the good news that Indigo has brought to us Eclipse users and Java developers, I think Ill keep my previous experiences with Eclipse’s Maven integration to myself for now.  Ill probably spend my weekend testing this feature and post some updates if they finally nailed it, I still have  high hopes though. 
  4. Jubula provides automated functional GUI testing for Java and HTML.
  5. Xtext 2.0 makes it even easier to create domain specific languages.
I will update you on items 4 and 5 maybe next weekend or at the end of the month after I have spent more time with Indigo.  Also I must admit that with regards to Xtext and Jubula, automated functional testing and the hobby of creating your own programming languages and domain-specific languages is really not my forte although automated testing is my first love since I started out as a Quality Assurance Engineer/Programmer when I was still a working student way back during my college days.
Thanks for reading and don’t forget “In opensource we trust“.

How to get Maven working through a proxy server

Maven, is a Yiddish word meaning accumulator of knowledge.

Maven is a tool that can now be used for building and managing any Java-based project, something that makes the day-to-day work of Java developers easier.

Maven’s Objectives

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features

I personally think that mavens greatest contribution to the opensource community is the way it provides developers with  a uniform build system.  Further information about maven can be found at http://maven.apache.org/index.html and tutorials on how to use maven is just a google away.  The only problem that you might encounter with maven is how to get it working through a proxy server.

To save you time, below is the line of code you’ll append at the end of your maven command so that maven would work properly even if your using a proxy server.

-DproxySet=true -DproxyHost=ur.proxy.server -DproxyPort=port

where -DproxyHost value is “YOUR PROXY SERVERand -DproxyPort is“YOUR PORT NUMBER”

You can view your proxy settings through

Internet Explorer >> tools >> internet options >> Connections >> LAN Settings

Fire Fox >> tools >> options >> ADVANCED TAB >> settings

If you find yourself using maven from time to time specially to gather dependencies I would suggest you manually edit your maven settings.  There is an existing official tutorial on how to do this at http://maven.apache.org/guides/mini/guide-proxies.html but to save you time, below is a portion of the tutorial which I copied from their site.

You can configure a proxy to use for some or all of your HTTP requests in Maven 2.0. The username and password are only required if your proxy requires basic authentication (note that later releases may support storing your passwords in a secured keystore – in the mean time, please ensure your settings.xml file (usually ${user.home}/.m2/settings.xml) is secured with permissions appropriate for your operating system).

The nonProxyHosts setting accepts wild cards, and each host not to proxy is separated by the | character. This matches the JDK configuration equivalent.

<settings>
  .
  .
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.somewhere.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    </proxy>
  </proxies>
  .
  .
</settings>

Please note that currently NTLM proxies are not supported as they have not been tested. You may be able to use the relevant system properties on JDK 1.4+ to make this work.

Follow

Get every new post delivered to your Inbox.

Join 60 other followers