I am currently working on a team Java project. Our team use Maven to manage dependency and Travis for continues integration. The only problem is that when we have a dependency which is written by ourselves, we have to compile and install it before the testing.
Fortunately, Travis-CI provides
before_install option which allows us to install our own dependency before testing the target. If we host our dependency on GitHub, actually it is easy to implement. There is an example that install a maven based project as local dependency so that we can compile our project.
before_install: - ( git clone https://github.com/Study-Master/Java-WebSocket.git /tmp/Java-WebSocket && cd /tmp/Java-WebSocket && mvn install -Dmaven.test.skip=true )
In this command, first we fetch data from GitHub then use
mvn install to install it as a local dependency. We run the whole shell script as a subshell so that we won’t leave current directory after executing this command (refs to http://stackoverflow.com/questions/21983739/stay-in-the-current-directory-after-bash-script/21983818?noredirect=1#21983818.