oskopek/carcv — pull request #27 by oskopek (2014-03-13 15:22:44+00:00)
Title: Fixes failing integration tests

The actual cause of the build failure was not the tests or this project at all - it was JasperReports. The fix consists in creating a mirror for the artifacts hosted at JasperReports. For details, see [this StackOverflow question](http://stackoverflow.com/questions/20298954/maven-fails-to-pull-dependencies-on-travis-ci-connection-timed-out/22382234#22382234).

## The answer

(...) The problem seems to have been a networking, or rather, load management issue. Maven doesn't seem to like how the jasperreports repository responds - for the last few builds, it would just hang and the build would timeout ([see here](https://travis-ci.org/oskopek/carcv/jobs/17796542)).

There are multiple ways you could solve this:

1. Download a version of the jasperreports library with all dependencies, put it in a `lib/` folder in your code base and have maven load them from there
2. Have Travis download and extract an archive of the jasperreports library with all it's dependencies at test-time (in order not to pollute your code base)
3. Mirror the jasperreports maven repository on your own server

I liked the third approach best, so I decided to create a little bash script:
```
#!/bin/bash
export DIR=$HOME/temp_jasper/
export TARGET=$HOME/jasper-mirror/
mkdir $DIR
cd $DIR
wget -r --page-requisites --convert-links --no-parent http://jasperreports.sourceforge.net/maven2/
mkdir $TARGET
mv $DIR/jasperreports.sourceforge.net/* $TARGET
```
Schedule a cron job to do the work daily/weekly/monthly/manually (whatever you want).

I created an OpenShift app using the [httpd cartridge created by Stefano Zanella](https://github.com/stefanozanella/openshift-cartridge-httpd), ran the script locally to get the files, added them to the root directory of the git repository, and pushed. You can see the repository files live [here](http://httpd-oskopek.rhcloud.com/maven2/).

After that, change the jasperreports repository in your pom file:
```

jasperreports-mirror
http://httpd-oskopek.rhcloud.com/maven2/

```

Commit, push and see the build turn green.