svn checkout and debugging - maven

I have access to a project on SVN server and need to debug and understand the project. I exported the project as to ensure no changes affect the production or most recent updated version. But I cannot successfully run the ANT build as it looks for the jar files on the SVN server.
Can the project not run locally like this with my machine able to ping the server? I am familiar with MAVEN but not ANT so not sure if the checkout plays an important part in this.

Since this is in version control, you can change things and see what happens.
For example, if you have the jar files in a different location, change the ant script and see if it works.
If you type
svn status
it tells you the status; svn st for short.
If you want to roll back
svn revert [filename]
will put the script back as it was.
You need to do a svn commit to send changes back to the server.
Don't be afraid to try things locally.

Related

How to update a Windows machine with changes done in a git repository

I am planning to do below
Copy from git repository to a Windows machine each time a commit/ update is made to that folder only. May be something like Jenkins can be used for same but unable to determine how can I do it?
Check commit made to repo ( this I have done)
As soon as commit is made to repo, trigger a jenkins job that will update this change to a windows server ( How to do this?)
If the repository is local, it would be easier to push directly to the Windows machine, assuming it has an SSH server (which Windows 10 2019.09 and more now have)
If the repository is distant, you can configure a webhook in order to call a Jenkins server for a specific job.
See for instance "Triggering a Jenkins build every time changes are pushed to a Git branch on GitHub" by David Luet
Or you can define a Jenkins pipeline that GitLab-CI can execute.
In both cases, your Jenkins job will have to copy the checked out repository.
I would use git bundle to compress the repository into one file (or a simple tar), copy it over the Windows server, and decompress there.

SVN commit using Jenkins

I recently created an automated process to run multi-step Maven builds for my organization. They now are looking to have the entire process automated using Jenkins. I have been able to successfully create branches, builds, change versions, etc., using Maven commands but I am having difficulty committing the version changes (1.0.1-Snapshot to 1.0.1-E1 for example) with Jenkins. I have tried using basic commands like:
SVN commit "Comments"
However, Jenkins does not seem to know what to do with these command lines in the "Execute Windows Batch File" Post Build option. I simply receive build failures caused by the batch file for "unknown reasons." I see the help desk I am working with has installed the Subversion plugin, but perhaps something else is missing. I know that when I use the command prompt locally I need to use something like this:
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe"
/command:commit /path: /url:
However, Jenkins is hosted by a third party and I do not have direct access to the servers so I would not be able to implement that kind of path data. So I am now looking to see if I can run this, somehow, purely through Jenkins as my client requests.
Anyone have any success with SVN Commit to update version changes through Jenkins?
Thanks!
-Cameron
Why did you decide to run TortoiseProc via Jenkins? TortoiseProc is not the right tool for this task, use svn.exe client.
TortoiseProc can be used for TortoiseSVN's GUI automation, but this case is completely different to running Jenkins.

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?
Thanks
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. http://your.svnsever.com/path/to/project)
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 maven/pom.xml.
Under Goals and options, enter clean install
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.

Synchronizing Visual SVN with IIS for web development (or to any other folder)

How to get the latest version of the project file to another folder on every commit?
I'm using VisualSVN server and I think we can do this on post-commit in hooks, but I don't know how. Server is on Windows.
Actually I need to get the latest version of the file to \www folder of IIS7. Simply, get the latest file to another folder.
I've added following code in post-commit hook (for copying latest version files to D:\Destination).
svn export --force file:///D:/Repositories/myproject D:\Destination
exit 2
It works fine for me.
If your trying to export this to a directory of website, need to change the directory permission. Visual SVN is using NETWORK SERVICE.
If you use the same file in more than single folder inside your repository and you Subversion is 1.6 or newer, you can use file-type of svn:externals without binding to revision.
In this case committed to SOURCE file will be updated in Working Copy of TARGET after usual svn up
but I don't know how
You correctly say that you have to do it by post-commit, but if you mean you don't know the process, here is how.
Your post-commit hook is a script which is called after every commit to a project in your SVN repository. There is a file called post-commit in the hooks folder of every repository. Change the file to include the necessary commands* to do the copying for you and make it an executable post-commit.exe.
Afterwards, every time you commit a new revision, that script should handle it for you.
*By necessary commands I mean, either do the copying via the Windows cmd prompt, or call another script to do the job from within post-commit.exe.
Also, even though SVN docs mention that the post-commit hook needs to be either .bat or .exe file, I've had it working only when it's .exe on my machine.
You can convert .bat files into binary .exe using tools available here and here. The second one is much more user-friendly. I hope it helps.

buildr from svn repository

I would to run buildr on my svn repository - to build the files from \src\main\java in the subversion repository with username and password and save it to anther location on my disc.
How can I do it?
if i understand your question correctly, you are trying to setup a contiuous build system. checking out source code is the responsibility of your CI system. it would poll your svn, git or whatever cvs you use for changes and then build it on the configuration you provide.
a free build-server is jenkins (aka hudson). if you want a hosted solution you can go for travis-ci (it's free). or something expensive like atlassian bamboo.
You will have to write an Ruby build script - that when you execute will:
Checkout the source
do the 'buildr'
Commit the built file(s)
http://www.markdeepwell.com/2010/06/ruby-subversion-bindings/
http://blog.carlossanchez.eu/2009/08/18/using-subversion-ruby-bindings/
the easiest way is run external svn commands
task :checkout do
system 'svn checkout ..'
end

Resources