Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skip first mvn install in travis-ci

Tags:

travis-ci

I'm having troubles building a project with maven on travis-ci because travis automatically runs

mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

which fails because of a timeout:

No output has been received in the last 10 minutes, this potentially
indicates a stalled build or something wrong with the build itself

According to the documentation I should be able to override it defining a custom script in .travis.yml but it does not work, here my configuration:

  sudo: false
  language:
    - java
  script: "travis_wait mvn -T4 -pl quickfixj-codegenerator install"
  jdk:
    - oraclejdk8
  env:
    - MAVEN_OPTS="-Xms2048m -Xmx=2048m"
  branches:
    only:
      - travis-ci-build

Is there any way to avoid the automatic mvn install or to tweak it ?

like image 635
Luca Burgazzoli Avatar asked Aug 11 '15 15:08

Luca Burgazzoli


3 Answers

I have found it useful to have an install: mvn dependency:resolve step that downloads the build dependencies up front, so that the output of the actual build script is kept clean

like image 60
Liam Williams Avatar answered Oct 19 '22 17:10

Liam Williams


This is mentioned in the documentation:

https://docs.travis-ci.com/user/job-lifecycle/#skipping-the-installation-phase

Skip the installation step entirely by adding the following to your .travis.yml:

install: skip

The install step runs before script step, and with Maven you don't usually need the install step, at least I personally haven't ever found it useful — Maven will download dependencies on script step anyway.

like image 12
gvlasov Avatar answered Oct 19 '22 15:10

gvlasov


I had the same issue. It was solved after some discussion with the Travis CI support. Here is their response:

That maven command is run as part of the install section of your build, it's the default.

If you want to skip this step, you can override it by adding this to your .travis.yml file:

install: /bin/true

like image 9
cthiebaud Avatar answered Oct 19 '22 17:10

cthiebaud