Publish JavaDoc on Jenkins with maven - maven

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.

Related

How to run a maven plugin without a POM in Jenkins?

I have a plugin which can run either using a pom.xml or without (depends upon the version of the artifact we're building: new versions go without a pom. Strange, I know).
I want to have that plugin run in Jenkins.
But when creating a maven project, I have to set a pom (or as a default, Jenkins suppose there is one in the base folder given).
Question: Is it possible to configure Jenkins to not use a pom when there is none?
As per my comment, you should use a Jenkins freestyle project build in this case, in order to have more flexibility and avoid the default assumptions of a Jenkins Maven build.
In such a build, you can then configure a build step executing a shell or a Windows command (depending on the Jenkins server OS).
Indeed, in the Jenkins Maven build, a pom file is always required, as mentioned in the help support of the Configuration > Build > Root Pom entry
If your workspace has the top-level pom.xml in somewhere other than the 1st module's root directory, specify the path (relative to the module root) here, such as parent/pom.xml.
If left empty, defaults to pom.xml

How to setup jenkins to run Selenium / Maven / TestNG

I'd like to be able to run by Jenkins a series of test from Selenium. I've see a lot of topic about the subject but it's not clear to me.
Do I need to call maven to run the project or can I directly call Testng ?
Also do I need with Jenkins to call my project using maven or using Ant ?
What is the best practice. Is there specific plugin that I need.
Do I need to call maven to run the project or can I directly call Testng ?
You can call testng through maven or ant. There is no direct runner plugin for Jenkins.
What is the best practice. Is there specific plugin that I need.
You might need the TestNG plugin to show the results inside Jenkins, but it is optional. Best practice is to use maven or ant. You can find a nice ant example here
You can use run TestNG scripts in Jenkins with or without Maven. Maven as a build tool, in my opinion, looks more robust and gives you more flexibility than Ant.
To run pure TestNg script in Jenkins, enter the following in the 'build' section:
D:>java -cp "Pathtolibfolder\lib\*;Pathtobinfolder\bin" org.testng.TestNG testng.xml
Click on Save button.
Note: The actual path of lib and bin folder need to add the in above
command.
After saving the command, Jenkins will build project in predefined
time, and this command will run using TestNG.
The result will be stored in custom report HTML file that can be sent via
email with a small Jenkins configuration

How to use ANT in Cloudbees

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.

is it possible to do a Maven build using Build Forge?

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)

How to configure Hudson to use Maven for dependecies and run JUnit

In Eclipse I have my "Dynamic Web Project" configured with Maven taking care automatically of all my dependencies (once I specify them in pom.xml). After implementing my Unit Tests I can simply run them all by right-clicking on project and selecting: Run As -> JUnit Test.
How/where can I now configure Hudson so after checkout of all my sources from SVN repository it would automatically invoke(?) Maven (to download all dependencies) and then run all available tests with JUnit?
When you set up a project in Hudson (now Jenkins) in the configuration page you may choose the build phases that Jenkins will run. Then it will run them in the order you specify. There you will have Maven steps where you'll define your goals.
Jenkins itself has to know where to find a Maven installation (or Ant, or any other command that it must run to build). This could be done in the server configuration page.
I think that's the default behavior of Hudson (compiling + running tests).
Did you commit on your svn repository the pom.xml file?

Resources