Reputation: 31
I am writing an automated testing project for school using maven and I need to implement CI to our project. Since Gitlab has its own CI, I decided to use it.
The problem is that the project itself is inside of a folder in a Gitlab repository. I created a branch for that project, but the branch main body includes the project folder, so when I create a gitlab-ci.yml file, it cannot find the POM.xml file in the folder. So my question is that is there a way to make the yml file recognize the POM file by adding some sort of variable to it?
I know there are "only:" and "changes:" keywords for the yml file but that doesn't seem like it will help recognize the pom file. Also manually pushing a yml file that is inside of the project folder does not help. I haven't tried moving the POM file because the project grade is also dependent on the quality of our commits, so I would rather not commit wildly.
Upvotes: 1
Views: 1594
Reputation: 31
Using
- mvn -f project/pom.xml compile
instead of -mvn compile
in the build: section of the .yml file solved it for me. I was blind and didn't see that there was a help section in the log that already answered my question.
Upvotes: 2