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.
Related
I am using a Bamboo CICD pipeline to build and deploy spring boot jar using maven release. Build is working fine and a spring boot jar is created. Since maven release updates the jar version after every run, I am unable to use this jar in the next stages of bamboo pipeline.
I have gone through bamboo documentation and discussion forums in Atlassian and Stackoverflow but unable to get the required solution. I tried to get the artifact in the next stages using "Artifact Download" task but unable to use it since jar version always varies.
I tried to fetch the shared artifact file using regular expression such as target/*.war in the deploy step (Command task - Argument field) but guess bamboo is not able to execute the regex. It is giving the following error message.
Incorrect Usage: The specified path 'target/*.war' does not exist.
If I give the correct name such as target/appname-0.0.1-snapshot.war bamboo is able to find the war file and deploying it successfully.
Is there any way that the exact war or jar name can be obtained in further stages without the need of manual update after every run? Any help on this would be greatly appreciated.
Regular expression is not working in the command task but I was able to resolve this issue by using the bamboo script task. Regular expression is working fine and target/*.war has been resolved correctly.
You can also try Maven POM Value Extractor plugin. This plugin provides a build task that extracts values from Maven POMs and sets build variables using those values. This allows you to keep you Bamboo variables in sync with your Maven POM.
You can automatically extract your artifact's GAV (GroupId, Artifact, Version).
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
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.
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)
I've got a Maven project that Jenkins builds and deploys to a remote repository. I then need to copy the deployed .war to an external location. I've been trying to do this with a post-build shell script but I don't see any way to get the build information from maven (for example, the URL of the deployed artifact). Is there a way to get it, or a way to do this that's more integrated into maven? I can calculate the deployment path using Jenkins build parameters but it seems like a hack.
Thanks,
Steve
After a maven build you should always find the build artifact at
target/<artifactId>-<version>.<packaging>
You can access this path within the maven pom.xml by using the maven properties (see pom reference)
${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging}
To copy the artifact to another location after the build you can use several approaches described e.g. in this thread.