Varun
Varun

Reputation: 4452

No such file: ‘pom.xml’ error in jenkins

I have a repository in Bitbucket. In that repository i have project called Demo Which is a maven project. I am trying to deploy Demo with Jenkins.

Steps I am following.

  1. Created a job(Item) in Jenkins.
  2. Configure(This is the configuration for the individual jobs).

    Project name:Demo.

    Description:bla bla bla..

    Source Code Management -> Git -> Repository URL :[email protected]:UserName/ProjectName.git.

    ->Credentials: provided my credential.

    Build-> Root POM : pom.xml.

Everything looks fine but pom.xml throwing error saying :

No such file: ‘pom.xml’

Since this is the maven project it is looking for pom.xml, and I am confuse while providing the path. since Jenkins is pooling source from Bitbucket, which have pom.xml under Demo project.

But I do not know which path to provide here.

Upvotes: 6

Views: 47214

Answers (5)

OdeandieFreude
OdeandieFreude

Reputation: 1

Need to confirm if the Repository URL and specified branch are filled in incorrectly enter image description here

Upvotes: 0

Ironluca
Ironluca

Reputation: 3762

I am fashionably late to the question and this is not really an answer. I am documenting a situation that I faced, which may help others to solve the 'no such file' issues with Jenkins.

My environment is SVN, Maven (3.8.4) and Jenkins (2.330) on Windows.

I needed to check out 3 code base from SVN, say o-base, p-base and p-core.

There is a Maven inheritance, p-core --> p-base --> o-base (the top level pom), the relative paths in the poms point accordingly.

I checked out the code from SVN in this order, o-base, p-base and p-core. (o-base check out was strictly necessary as the artifact a single pom is available in local Nexus).

All the source is checked out in the following directory structure: $workspace/o-svn-base/o-base $workspace/o-svn-base/p-base $workspace/o-svn-base/p-core

The objective was to package p-core.

In the Jenkins Invoke top-level-maven Targets, I gave the pom file path as ./o-svn-base/p-core/pom.xml (relative to the workspace), the file was not found.

What worked was ../p-core/pom.xml

It is quite evident that Jankins took the first check out directory as the code directory and calculated the pom file path relative to that. This behaviour is not quite documented anywhere (or perhaps I could not locate); however, this is quite non-diterministic.

The answer suggested above, with $workspace; $workspace/o-svn-base/p-core/pom.xml (yes, forward slashes worked on Windows) worked.

In my view, this is the right way of approaching the relative path resolution as it is absolutely deterministic.

Upvotes: 0

Rishi12
Rishi12

Reputation: 41

use $workspace\"Directory name where the pom.xml present"\pom.xml

Upvotes: 0

prudviraj
prudviraj

Reputation: 3744

If you have your pom.xml in your workspace then use below command in ROOT POM.

$workspace\pom.xml

Upvotes: 7

Hilal H Muhammed
Hilal H Muhammed

Reputation: 86

You have to mention the path of your application's pom.xml in relation to jenkins work space.

Once Jenkins build starts it will download the source code to .jenkins\jobs\yourjobname\workspace and builds it there, you can check this location if you are not sure of the pom path.

E.g For an application Test .jenkins\jobs\jenkinsJobName\workspace\Test\pom.xml

The root pom field should be Test\pom.xml

Upvotes: 7

Related Questions