Search code examples
javagitmavenjenkins

How to Specify subfolder for Maven in Jenkins?


I have the following folder structure:

  • Finance/Code
  • Finance/Docs
  • Finance/SQL

The GIT repository is created on Finance folder. I configured Jenkins to look at GIT repository in /Finance. The maven pom file is located in Finance/Code. When I run the Jenkins build, I got this error:

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/Macpro/.hudson/jobs/Publishing/workspace). Please verify you invoked Maven from the correct directory. -> [Help 1]

How to configure Jenkins to look at /Finance/Code for the pom file?


Solution

  • As illustrated by this question, you should fill out the Root POM field with a relative path:

    root pom

    Relative means from the Jenkins workspace:

    Code/pom.xml
    

    (no leading /) That is, if Finance is the root of your workspace.