5

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.

4
  • 4
    Did you run the job? In order for Jenkins to "see" the pom, you should have the job clone the repository at least once. If the pom.xml exists in the repository root, the job will see it. Try running once and then open configuration again to see if the error is still there. Jul 1, 2015 at 13:44
  • @EldadAK you should probably add it as an answer. This is the most straightforward resolution. Jul 5, 2019 at 6:56
  • when ever we are push the code push the code from inside the project structure not outside project folder . example: maven project name is springfirstapp open this springfirstapp folder there is a project structure(.settings ,src target pom.xml) in these structure place only you should push the code . Jul 26, 2021 at 17:41
  • There's no "Root POM" in Jenkins 2.375.2. Jan 16 at 8:30

4 Answers 4

7

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
7

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

$workspace\pom.xml
1
  • that solved my problem, but for unix like systems should be a forward slash $workspace/pom.xml
    – chao
    Nov 18, 2015 at 9:28
0

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

0

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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.