Create job in jenkins with calling svn and maven
For now I have a batch file with commands for update projects using svn and calling maven ‘clean install’. How to create some job in Jenkins for similar actions?
Should I write it to ant file (sorry if it’s stupid idea, I’ve just heard about it but I don’t know what is it exactly and what can I do with this) or there is other way?
- Update git-svn list of remote branches
- Creating a branch with TortoiseSVN without /trunk structure
- Convert an SVN repository to git with reposurgeon without creating .gitignore files?
- SVN: Ignore some directories recursively
- How do I browse an old revision of a Subversion repository through the web view?
- When you move files around in Visual Studio will Ankh SVN turn that into a SVN move?
3 Solutions collect form web for “Create job in jenkins with calling svn and maven”
Like arghtype suggested, you need to be using Jenkin’s own Source Code Management by configuring SVN as SCM source and supplying credentials as part of Maven build job.
If you have to use your own local working copy, you are organizing it wrong, you will lose on all the benefits of having Jenkins manage SVN changes, and in the end, this organization will give you more unsolvable problems in the future. Think about the advice people are giving here and come with up a reason why you need to have a local workspace outside of Jenkins management on a Jenkins build machine. My only guess is: your Jenkins and Development machine are the same. That again is not how it should be organized. Jenkins is a CI-server, not a personal build “automator”.
Regardless, if you still want to do what you say.
What you think you want
- Create a new Freestyle job
- Under Build Steps, click Add build step
- Select Execute Windows batch command
- Write your batch execute command in there. Your working directory will be Jenkins’s
$WORKSPACE, so change your path accordingly to where you want to run it.
But with the above configuration, you might have as well put the batch file under windows scheduler… You are not really using Jenkins with the above.
What you should do instead
- Create a new maven2/3 build job
- Under Source Code Management, select Subversion
- Under Repository URL enter the remote SVN repo (i.e.
- Under Build, enter your Root POM location (this will be relative to the location of your SVN checkout, so if your POM is under
http://your.svnserver.com/path/to/project/maven/pom.xml, then enter
- Under Goals and options, enter
- Click Save
The Source Code Management section will take care of setting up a local workspace and checkout the repository into that workspace. By default, every time a new build is triggered, it will run
svn update on that workspace for you.
The Maven Build step will take care of running your Maven, however note that it is configured to use default
~/.m2/repository location. If your local maven repo needs to be different, change this under Jenkins Global Configuration
- Create a new job.
- In Source Management choose Subversion, specify your repo and credentials.
- Add a new build step – maven build, specify your maven goals (‘clean install’).
Jenkins is a CI(contiounus integration) server. It can be used to generate scheduled builds of ant or maven based projects. It can also start building projects by some triggering event such as a commit to SCM (git, svn, mercurial,…)connected to it. You really have to read its documentation to get a better understanding. It has nice tutorials.