Unable to read pom.xml in jenkins - maven

I am able to build the code from the dependencies as a free style jenkins job. But when I creating a pipeline and during the package stage I am getting the following error:
Error*
POM file $workspace/project/pom.xml specified with the -f/--file command line argument does not exist
How can I make pom.xml readable I am using maven here.

Related

Maven verify on a sub-module fails with 'dependencies.dependency.version' for some.artefact:jar is missing

In a Jenkins CI job, a single module of a multi-module Maven project is checked out from svn and the following Maven goals are specified:
clean verify pmd:pmd
The build fails with the error message
org.apache.maven.project.ProjectBuildingException: Some problems were
encountered while processing the POMs: [ERROR]
'dependencies.dependency.version' for org.jdom:jdom2:jar is missing. #
line 162, column 21
The missing version is only specified in the main (master) pom, which was not checked out.
To fix this I can check out the whole multi-module project, but are there other options which limit the check-out to only the required files - the master pom.xml and the module?
Additional information: the build worked well in the past, with many other dependency versions which were not specified in the module. All these artefacts were already in the local .m2 repository. Now with a new dependency this error occurs. I guess that it has something to do how Maven handles version matching when artefacts are already installed.
Jenkins offers to perform more than one check-out operation for a Maven build job. In the first one I specifiy the path to main (master) project, and set repository depth to "files". The second contains the module to-be-verified.

Jenkins is unable to recognise the Parent Pom file

When I'm running the CI Job locally everything is working as expected. When I'm executing the same via Jenkins, few times it is able to recognize the POM file and few times it is unable to recognize the POM file. And throws the error stating " Non readable POM".
Checked on the docker agent where this job is running and found that Jenkins is only recognizing the file folders but not the POM file (available on the root).
The ls command result proved me that Jenkins is not picking the POM file.

Running Maven project by adding dependency

I am trying to run this DDR (Deep Dependency Representation) conversion tool from Emory NLP: https://github.com/elitcloud/elit-java/tree/master/elit-ddr
I have created a new Maven project in a new directory called depConverter and added the specified dependency from the website into the pom.xml file in DepConverter. This pom.xml file was the one built from automatically creating a new, default Maven project. I think I am missing something from this pom.xml file to properly run the DDR tool, as when I run the specified command line command java cloud.elit.ddr.bin.DDRConvert -i relcl.parse -oe tsv in depConverter, I get the following error:
Error: Could not find or load main class cloud.elit.ddr.bin.DDRConvert
I am not totally clear on how Maven will load this class. Do I have to create a java file to run this tool?
Assuming, the question is about running from the command line:
DDR library is not in the classpath when you're trying to run from command line. That's why JVM cannot load the main class that is expected to be found in this library.
So you can try to run:
java -classpath <PATH_TO_DDR_JAR> cloud.elit.ddr.bin.DDRConvert -i relcl.parse -oe tsv
This is the easiest way.
The jar is expected to be found in the local maven repository (~/.m2/repository by default).
Maven is a build tool in a nutshell and it doesn't run anything inside your artifact/ one of the dependencies like in your case.
Alternatively, if you want to "use" the information provided in pom (like a dependency graph), you still can run mvn exec:exec / mvn exec:java plugin and supply the relevant parameters to run the class of your choice.
You can find more information about exec plugin here.

How to skip some java files from compilation in maven using command line?

I am using maven with jenkins. On eclipse the project build works fine. When I use jenkins I get the following error
[ERROR] /E:/jenkins/workspace/product/src/test/java/com/new/ftp/FTPTest.java:[102,55] package com.fasterxml.jackson.databind does not exist
The options for maven are as follows:
mvn clean install -X
I want to know if I can pass some arguements to maven to skip that package. I don't want to modify my pom.xml yet .
P.S - The project consists of a main pom.xml which calls other child modules.

Maven build using Jenkins

I created a job to build the maven project, by configuring Jenkins as per standard conventions like:
svn repository URl: valid link
Under Build section:-
root pom: location of pom.xml file
goals and options: clean install
saved and started build
got console output as :
Parsing POMs ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[WARNING] 'version' contains an expression but should be a constant. # line 8, column 11
where line 8 is:
<version>${dsstextversion}</version>
if it is asking for version no., then how to invoke version no. into this ?

Resources