I want to pull a selenium based maven project from VSO/github in Jenkins and then execute it from another project.
I have already created a project that pulls the code from VSO. Its working fine.
But how do I execute its pom.xml from another job in jenkins.
Process will be:
2 jobs will be there in Jenkins-
JOB1-Pull the project from VSO/github(Done)
JOB2-If JOB1 succeeds then trigger JOB2 which will execute the maven project using pom.xlm which has been pulled in JOB1.(How to do it?)
Thanks in advance.
Use pipeline plugin in jenkins: https://jenkins.io/doc/book/pipeline/
Found an alternative and pretty easy solution to this problem.
Need to follow below steps:
Create a Freestyle project first.
In General section of configuration click on Advanced button
Check Use Custom WorkSpace check box
Give a directory where you want to pull the project
Configure VSO/github/svn from Source Code Management
Save the configuration
Create another Freestyle project
Give the same directory as used in First Project for Use Custom WorkSpace
Invoke maven target from this project
In Post build action of the Project1 invoke Project2 when Project1 succeeds
Build Project1
Works fine for me.
Although not sure why I am not getting Use Custom WorkSpace check box for maven project.
Related
I have a maven project on my local system, but I created a freestyle project in jenkins and gave its the workspace directory as of my project.
Being new to jenkins, I am wondering how to add maven repository jars to a freestyle project's classpath while writing its batch file to execute the project, in such a way that all the jars which are in recursive directories
C:\users\xyz\.m2\repository\*
come in the path while building the project. I don't know whether it is possible or not without any hassle, but when we create a maven project in jenkins it automatically takes all the repository jars in the build path. So there must be a way around rather than putting those libraries manually into the build path. I have searched so much on google but nothing popped up.
Any input would be appreciated.
Thanks
I recommend you to use EnvInject Plugin. This will prepare environment to be built before the job run. So in your case adding the path can also be done using this one. If you are running the jenkins on windows machine, doing this will do the trick. Or if you are running on Linux please feel free to explore or comment here again.
I'm trying to move an existing ANT build script (build.xml) into Cloudbees for CI using Jenkins. I setup the project repository using GitHub. The build pulls the repository into the Cloudbees Workspace successfully, but then fails with this message.
Parsing POMs
ERROR: No such file /scratch/jenkins/workspace/project/pom.xml
Perhaps you need to specify the correct POM file path in the project configuration?
I'm not too familiar with this, but from what I can tell (thanks Google) it's because Cloudbees uses Maven instead of ANT. Is there a way that I can change Jenkins to run the ANT build script instead of using Maven? Or a simple way to execute my ANT scripts from Maven? Any help here would be appreciated!
Thanks
You do not need a Maven POM file if your project is Ant-based.
It sounds like you created a Maven job in Jenkins. Delete it and create a free-style job instead, then (as #thekbb says) click Add build step and select Invoke Ant and configure as needed.
ant support is provided by teh ant plugin, I think you get this automatically when installing jenkins. In your jenkins job, add a build step of type 'Invoke Ant' and provide the target.
I have maven project that is built by Jenkins-CI.
How to generate and publish JavaDoc on Jenkins?
Make sure Jenkins javadoc plugin is installed.
Go to http://yourjenkinsserver.com/jenkins/pluginManager/installed to see list of intalled plugins.
Plugin page https://wiki.jenkins-ci.org/display/JENKINS/Javadoc+Plugin
Configure Jenkins job:
In Build section, Goals and options line add:
javadoc:javadoc
That's all. No need to change pom.xml
The simplest thing to do is to create a separate task that runs thr javadoc command, and which runs after the compile task. You pass it the input and output directories.
I would run a separate tomcat for your CI website - it's easier.
I run test cases from jenkins with testng and i export the results in test link thanks to TestLink Plugin.
I have a little problem, since yesterday i try to get the test cases using git. I can download all the git repo, but when i build the project in jenkins, maven try to compile all the files downloaded from git repo (about 4500 files) and i have only 5 test cases at the moment ...
my Git repo looks like
Folder 1 -> ...
Folder 2 -> ...
FolderTest->src->MyTestCasesAreHere.java
Is there any way to specify the path of the test cases, or to make maven compile only the files i want ?
i "invoke top level maven targets" with maven targets :test -DsuiteXmlFiles=suite.xml
is it the right way?
If you are just trying to build a subproject change the Root POM option under the Build section of your Jenkins job configuration. This is assuming that you are using the Maven2/3 job type.
Also, if that doesn't work think about passing in the -f command line option to Maven to control which POM your build is going to use: http://www.sonatype.com/books/mvnref-book/reference/running-sect-options.html
Is it possible to do a Maven build using Build Forge? Currently we use Build Forge, ClearCase and ClearQuest with Ant scripts; would like to try a Maven build. Not sure if I can I have no test environment so don't want to mess up any thing and still learning all this stuff too
Maven can be invoked from any build automation framework.
Create a buildforge step that invokes your Maven build as follows:
mvn -s /path/to/maven/settings/files/mysettings.xml clean package
Explicitly selecting the settings file is recommended as this enables you customise the Maven configuration for each project.
Project isolation can be further enhanced by ensuring that each project has it's own local repository location (See the "localRepository" parameter in the settings file documentation)