Question

I get maven error :

"Cannot get the revision information from the scm repository"

Any idea how to solve this ?

Thanks.

Was it helpful?

Solution

A quick search on Google seems to indicate that this error is related to the buildnumber-maven-plugin. However, I couldn't reproduce the error on the command line on my machine (Maven 2.2.1, Java 1.6.0_16, svn 1.6.5 on GNU/Linux):

pascal@laptop:~/tmp/$ svn co http://wiquery.googlecode.com/svn/branches/1.0-m2 wiquery
...
pascal@laptop:~/tmp/$ cd wiquery
pascal@laptop:~/tmp/wiquery$ mvn validate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building WiQuery project
[INFO]    task-segment: [validate]
[INFO] ------------------------------------------------------------------------
[INFO] [buildnumber:create {execution: default}]
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /home/pascal/tmp/wiquery && svn --non-interactive info
[INFO] Working directory: /home/pascal/tmp/wiquery
[INFO] Storing buildNumber: 208 at timestamp: 1256499766371
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sun Oct 25 20:42:46 CET 2009
[INFO] Final Memory: 13M/77M
[INFO] ------------------------------------------------------------------------
pascal@laptop:~/tmp/wiquery$ 

From what I can see on Google, possible causes of problem include:

  • svn executable (i.e. svn.exe on windows) not being on the path
  • too old svnkit version compared to your svn client (see this thread)
  • missing environment variables on OS X (see MOJO-1289)
  • etc etc

But without more information on your context, your environment, what you are doing, when this error occurs, etc, it seems hard to go further in the diagnostic.

OTHER TIPS

I've run into this error with the buildnumber-maven-plugin when I was helping a coworker migrate his project to Maven.

We had not yet checked the code into svn in the migrated project, so therefore the .svn folders didn't exist. Obviously it couldn't get the svn revision since the data did not exist.

The solution was to comment out the plugin, import the code to svn. Perform a build with the svn enabled code, then bring the plugin back in and troubleshoot any additional errors. (We had some issues with doUpdate when running on Hudson, so we removed those steps).

This error is caused by the javasvn provider in the buildnumber-maven-plugin when .svn does not exists. Either checkout your project from SVN or do not use javasvn. Without javasvn the buildnumber-maven-plugin uses command line svn client and then in this case the buildnumber-maven-plugin can proceed even without the .svn directory (but the build number is not set correctly).

I think it is a bug in the buildnumber-maven-plugin that the javasvn cannot proceed when .svn directory is missing.

One case what we could resolve here with Netbeans8:

enter image description here

note that Prefer Old Subversion 1.6 Format is checked

and also I matched the correct apache SVN to the given maven properties

I had the problem too an my solution on Windows was: to set the environment variable PATH to "...\git\bin". Java couldn't find the directory to use Git.

Make sure Jenkins and the OS are pointed to the same version of Java.

I had a similar problem running Jenkins 2.121.2 on Windows.

The build would succeed, but I wasn't getting any scm data.

The relevant console output:

[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ amis ---
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: D:\Program Files (x86)\Jenkins\workspace\myWebapp
[WARNING] Cannot get the revision information from the scm repository, proceeding with revision of Unavailable : 
Exception while executing SCM command.
[INFO] Storing buildNumber: Unavailable at timestamp: 1534704912706
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: D:\Program Files (x86)\Jenkins\workspace\myWebapp
[WARNING] Cannot get the branch information from the scm repository, proceeding with UNKNOWN_BRANCH : 
Exception while executing SCM command.
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH

In DOS, the following command would work, however:

D:\Program Files (x86)\Jenkins\workspace\myWebapp\svn --non-interactive info

That is, I would get the expected scm info. So svn was in the path, no problem there.

It turns out the paths to my Java versions were crossed up.

The first Java-related path in my PATH environment variable was:

C:\Program Files (x86)\Common Files\Oracle\Java\javapath

But Jenkins was configured to use:

C:\Program Files\Java\jdk1.8.0_181 

In the PATH environment variable, I replaced the x86 Java path with the path that Jenkins was pointed to and it worked.

I didn't root out the hows or whys of the paths. The two java.exe files that resolved from each path seemed to be the same version. The x86 version was able to run svn. The root cause is above my pay grade.

huh... was working on migrating svn to git... and pom xml had svn repo link hence updated it to git and it worked with updating pom xml scm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top