hermit05
hermit05

Reputation: 117

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?

Upvotes: 4

Views: 1006

Answers (2)

hagai
hagai

Reputation: 464

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

Upvotes: 3

hermit05
hermit05

Reputation: 117

Got it working.

Corrected the yml format.

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

The above works.

Upvotes: 5

Related Questions