简体   繁体   中英

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

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

  1. <\/li>
  2. since Jenkins is pooling source from Bitbucket, which have pom.xml under Demo project.

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.

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

The root pom field should be Test\pom.xml

如果您的工作区中有 pom.xml,则在 ROOT POM 中使用以下命令。

$workspace\pom.xml

使用 $workspace\\"pom.xml 所在的目录名"\\pom.xml

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM