oskopek / carcv

CarCV - A car recognizing and speed calculating platform
Apache License 2.0
8 stars 13 forks source link

Fix for failing integration tests #27

Closed oskopek closed 10 years ago

oskopek commented 10 years ago

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.

This PR also updates all maven dependencies and provides minor reformatting of pom files and other configuration files.

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).

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, 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.

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

        <repositories>
            <!-- Own mirror of jasperreport's repository 
                 Original: http://jasperreports.sourceforge.net/maven2/ -->
            <repository>
                <id>jasperreports-mirror</id>
                <url>http://httpd-oskopek.rhcloud.com/maven2/</url>
            </repository>
        </repositories>

Commit, push and see the build turn green.

oskopek commented 10 years ago

Note - the build failed again.. Consider switching from Travis to Jenkins on OpenShift.