Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis CI build failing because my project is one level down from the git repository directory

Git repository:- xyz/repository
Project:- xyz/repository/project/pom.xml

.travis.yml: [kept in /project]
language: java
script: mvn clean install

Travis CI always executes the script in xyz/repository I tried with below

language: java
script: cd project 
        mvn clean install

But it still executes in xyz/repository

Error: The goal you specified requires a project to execute but there is no POM in this directory

Could someone please help?

like image 249
hermit05 Avatar asked Jan 28 '23 21:01

hermit05


2 Answers

Got it working.

Corrected the yml format.

language: java
script: 
  - cd project 
  - mvn clean install

The above works.

like image 140
hermit05 Avatar answered Apr 30 '23 07:04

hermit05


Create a bash script with simple cd commands before maven clean install. Then reference your bash script in .travis

build.sh :

cd git_repo/
mvn clean install

.travis.yml :

script: ./build.sh
like image 44
hagai Avatar answered Apr 30 '23 05:04

hagai