Nikhil
Nikhil

Reputation: 31

"No such file:" error in jenkins when integrating with Maven build

I have recently started using Jenkins as a CI tool for my Maven Selenium automation project.

The path of my local eclipse workspace is:

/media/user/Data/Automation_Scripts

and the complete path of the pom.xml file used to execute the project is:

/media/user/Data/Automation_Scripts/[project_name]/pom.xml

Now, I have installed Jenkins and added a Maven project to it. When I try to enter the path my project's pom.xml file in the 'Root POM' text field under 'Build' I get following error:

No such file: ‘/media/user/Data/Automation_Scripts/test/pom.xml’

error_message_section

Whereas if I navigate to the same path the pom.xml file is present. When I build the Maven project in Jenkins, following error is shown:

Started by user Test Building in workspace
/var/lib/jenkins/jobs/TEST/workspace Parsing POMs ERROR: No such file
/media/user/Data/Automation_Scripts/test/pom.xml Perhaps you need to
specify the correct POM file path in the project configuration?
Finished: FAILURE

Update:

I created a pom.xml file in my jenkins workspace which is located at:

/var/lib/jenkins/jobs/TEST/workspace

In this pom file have given path of my actual pom.xml (which is located in another folder) in the following way:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
<name>Maven Default Project</name>
<artifactId>jenkins_test</artifactId>  

<parent>
<groupId>ca.test</groupId>
  <artifactId>maven_test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <relativePath>/media/user/Data/Automation_Scripts/test/pom.xml</relativePath>
 </parent>
</project>


Still I am getting following error now:

Building in workspace /var/lib/jenkins/jobs/TEST/workspace
Parsing POMs
ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Could not find artifact ca.test:maven_test:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 6, column 9

at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1301)
at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1098)
at hudson.FilePath.act(FilePath.java:1018)
at hudson.FilePath.act(FilePath.java:996)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:960)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:679)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Finished: FAILURE

I guess there is something wrong with the relative path. Can you tell me what I am missing here?

Upvotes: 2

Views: 9274

Answers (1)

Anand Jumnani
Anand Jumnani

Reputation: 65

Try providing relative path instead of actual absolute path. By default jenkins job considers path as workspace path. Make pom.xml available in workspace of the job and provide path as just file name I.e pom.xml

Upvotes: 1

Related Questions