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’
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?
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
Related
I have followed the instructions for configuration of multi-module appengine projects here:
https://cloud.google.com/appengine/docs/standard/java/configuration-files
I copied the appengine-application.xml directly from the example provided, changing only the project name to use a Maven property. The file looks like this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<appengine-application xmlns="http://appengine.google.com/ns/1.0">
<application>${appengine.app.name}</application>
</appengine-application>
My appengine-application.xml file is located in the following directory structure:
projectname-backend/
src/...
pom.xml
projectname-common/
src/...
pom.xml
projectname-ear/
src/
main/
application/
META-INF/
appengine-application.xml
application.xml
MANIFEST.MF
pom.xml
projectname-frontend/
src/...
pom.xml
Even after cleaning the project, Eclipse is throwing this validation error for the file:
cvc-elt.1: Cannot find the declaration of element 'appengine-application'.
Other files, particularly application.xml in the same directory, are fine. So it seems to be namespace issue but I can't find any information on what it should be - this is current example in the Google doco.
Any ideas?
I am having client requirement that maven project which generate a war which in turn contains submodules as the jar?
let me clarify the question
This is my master pom.xml inside that i am having two modules named child1 and child2.
I need a MasterWebApp.war inside which the child1.jar and child2.jar presents.
If i changing the packaging as war to packaging - pom then error disappeared but i cant get the required war while maven clean install
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc</groupId>
<artifactId>MasterWebApp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Master Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<org.springframework.version>4.1.7.RELEASE</org.springframework.version>
</properties>
<modules>
<module>child1</module>
<module>child2</module>
</modules>
.......
you can execute two ways.
1) in eclipse.
Right click on project , click on run as --> maven build , give goals as "clean install" will generate war in target folder of your project
2) using command prompt, navigate to directory where pom.xml present and execute below commands
mvn clean install package
it will generate war in target folder
Thanks Raghav, i searched for any alternative way to achieve this, but no more available, so i used the way which u gave the link.
Thanks for the help.
I'm trying to build an application based on the Eclipse 4 RCP platform and built with Tycho. I followed the article http://blog.vogella.com/2013/01/03/tycho-advanced/ to use a PDE target definition, and the following error occurs when building my project:
[ERROR] Unknown packaging: eclipse-target-definition
My project's modules architecture is adapted from the EclipseCon 2013 Tycho Demo, plus the target module:
- mybundle.myproject.bundle
- mybundle.myproject.bundle.tests
- mybundle.myproject.feature
- mybundle.myproject.parent
- mybundle.myproject.target
I'm using tycho 0.18.1, and the pom.xml from the mybundle.myproject.target module that generates the error is:
<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>
<artifactId>mybundle.myproject.repository</artifactId>
<packaging>eclipse-repository</packaging>
<parent>
<groupId>mybundle</groupId>
<artifactId>mybundle.myproject.parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
</project>
For further info, the full debug log is here: http://pastebin.com/dMEckvsH
Is there something I'm missing? The eclipse-target-definition packaging should work with this Tycho version.
The problem cause of the problem is in the debug output you have linked. Compare the output before the failure ...
[DEBUG] Extension realms for project mybundle:mybundle.myproject.target:eclipse-target-definition:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging eclipse-target-definition from ClassRealm[plexus.core, parent: null]
... with the output of a previous, successful lookup of one of Tycho's packaging types:
[DEBUG] Extension realms for project mybundle:mybundle.myproject.repository:eclipse-repository:0.0.1-SNAPSHOT: [ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:0.18.1, parent: sun.misc.Launcher$AppClassLoader#affc70]]
[DEBUG] Looking up lifecyle mappings for packaging eclipse-repository from ClassRealm[project>mybundle:mybundle.myproject.parent:0.0.1-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]
Here is what you can read from the output: The project mybundle.myproject.target doesn't have any build extensions (i.e. in particular not the Tycho build extension) configured. From the second line of debug output, this seems to be because the project doesn't have the parent mybundle.myproject.parent configured like the other modules.
Eclipse Indigo SR 1, wtp 3.3.0, m2eclipse 1.0.100.
When publishing a project to WTP, I'm getting strange behavior with one of the dependencies; instead of putting the jar in the WEB-INF/lib folder, it's creating a folder named for the expected jar, and then putting the source tree (apparently) from that project under that folder. I can't see anything in the dependency's pom.xml or this project's pom.xml that could be causing this.
Other dependencies are being brought over just fine, as jars.
My test project's pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>dwhwtptest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>dwhwtptest Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-nyc-transit-data</artifactId>
<version>2.0.3-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>dwhwtptest</finalName>
</build>
</project>
Here's what ends up being published at workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps:
$ find dwhwtptest/
dwhwtptest/
dwhwtptest//index.jsp
dwhwtptest//META-INF
dwhwtptest//META-INF/MANIFEST.MF
dwhwtptest//META-INF/maven
dwhwtptest//META-INF/maven/test
dwhwtptest//META-INF/maven/test/dwhwtptest
dwhwtptest//META-INF/maven/test/dwhwtptest/pom.properties
dwhwtptest//META-INF/maven/test/dwhwtptest/pom.xml
dwhwtptest//WEB-INF
dwhwtptest//WEB-INF/lib
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/META-INF
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/META-INF/MANIFEST.MF
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model/NycQueuedInferredLocationBean.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/model/NycVehicleManagementStatusBean.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services/ConfigurationService.java
dwhwtptest//WEB-INF/lib/onebusaway-nyc-transit-data-2.0.3-SNAPSHOT.jar/org/onebusaway/nyc/transit_data/services/VehicleTrackingManagementService.java
dwhwtptest//WEB-INF/web.xml
And here's the pom.xml for the dependency, the onebusaway-nyc-transit-data module:
<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>
<parent>
<artifactId>onebusaway-nyc</artifactId>
<groupId>org.onebusaway</groupId>
<version>2.0.3-SNAPSHOT</version>
</parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-nyc-transit-data</artifactId>
<packaging>jar</packaging>
<name>onebusaway-nyc-transit-data</name>
<description>Common interfaces and classes for exchanging transit data between UI front-end and transit back-end data sources.</description>
<build>
<finalName>onebusaway-nyc-transit-data</finalName>
</build>
</project>
Suggestions? Anything else I can investigate to try to figure out what's going on here?
A colleague of mine provided me an approach that fixed the issue, but it requires few manual steps.
remove the project from your eclipse
go to your maven root folder with a terminal and kill all the eclipse stuff using this command (you will have to do this twice):
$> find . -iname ".settings" -exec rm -rf '{}' \; ; find . -iname ".project" -exec rm -rf '{}' \; ; find . -iname ".classpath" -exec rm -rf '{}'
on your maven root, execute this command:
$> mvn -Dwtpversion=2.0 eclipse:eclipse
import your project back in eclipse: everything will now work and eclipse will be publishing jars containing code :)
HTH, Bruno (credits to Theodore!)
I suggest trying out the m2e-wtp plugin in addition to your currently installed m2e plugin (which doesn't contain support for WTP based projects) This plugin is available in the Eclipse Marketplace via the embedded Marketplace client or on the web (http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp). It provides a tighter Maven integration with WTP and should improve the overall Maven with WTP experience.
If things still don't work go delete the publish folder. It will look something like:
<Path To Your IDE>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
First make sure you REMOVE the project under Tomcat or whatever other server you are using from withing the IDE. Then close the ID or you cannot delete the folder.
Once you do this, you can run your maven clean/build/install command and deploy your project.
If this does not work, this problem isn't related to the IDE or the Application Server.
Here, the story of my problem :
I want to upload a jar with a pom.xml with deploy command, but i want the jar uploaded doesn't contains in this name the version number.
For example, the pom.xml for the jogl.all.jar :
<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>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl.all</artifactId>
<version>2.0-b526-20111018</version>
<packaging>jar</packaging>
<name>Jogl</name>
</project>
My deploy cmd :
mvn deploy:deploy-file
-Durl=http://maven.iscpif.fr/thirdparty/
-DrepositoryId=maven.iscpif.fr
-DgroupId=org.jogamp.jogl
-DartifactId=jogl.all
-Dversion=2.0-b526-20111018
-Dfile=./jogl.all.jar
-DpomFile=./pom-jogl-all.xml
-Dpackaging=jar
The deployed jar equal here : jogl.all-2.0-b526-2011108.jar
But, when i call this dependency i want maven try to download a jar with this name : jogl.all.jar
Thanks for your advice :)
SR.
You cannot change the artifact name if you are deploying to a remote repository. This would break the way maven works.
Refer to #Pascal's comment in this related SO discussion as well.
You can change the name of the dependant jars while including them in the distribution using maven assembly plugin by using the property outputFileNameMapping. Something like the following:
<dependencySets>
<dependencySet>
<outputDirectory>/webapps/myapp/WEB-INF/lib</outputDirectory>
<excludes>
<exclude>${project.groupId}:${project.artifactId}</exclude>
</excludes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
</dependencySets>