nemerosa / versioning

Gradle plug-in to generate version information from the SCM branch (Git or Svn)
MIT License
200 stars 40 forks source link

SVN isn't working with url http://W.X.Y.Z/svn/company/branches/branch-name/project #56

Open Bno93 opened 5 years ago

Bno93 commented 5 years ago

If I try to use this extension under SVN I always get The SVN URL cannot be identified as atrunkor a branch: http://192.168.0.1/svn/company/branches/branch-name/project

I looked into the code and found out that in SVNInfoService.groovy in function parseBranch the Pattern /.*\/trunk$/ and /.*\/branches\/([^\/]+)$/ in combination with match() don't work for me.

It worked when I remove the '$' in both Patterns and use find() instead of match().

Did someone else had this problem?

dcoraboeuf commented 5 years ago

Hi, thanks for reporting this.

Do you configure the plugin in any way, in your build.gradle? If yes, can you post the configuration?

Thanks, Damien

dcoraboeuf commented 5 years ago

And which version of the plugin do you use?

Bno93 commented 5 years ago

Hi, thanks for the reply.

i'm currently using 2.7.1. add the dependency:

buildscript {  
  repositories {  
    jcenter()  
    maven {  
      url "https://plugins.gradle.org/m2/"  
    }  
  }  
  dependencies {
    classpath 'net.nemerosa:versioning:2.7.1'
  }
}
apply plugin: 'net.nemerosa.versioning'

the only thing I've done was to configure the plugin like

versioning {
   scm = 'svn'
}

then I got > org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for '<http://x.x.x.x:80>'

when I enter my svn credentials like

versioning {
   scm = 'svn'
   user = 'myUser'
   password = 'myPassword'
}

I got

> The SVN URL cannot be identified as a 'trunk' or a branch: http://x.x.x.x/svn/Repo/trunk/project-group/project

dcoraboeuf commented 5 years ago

Hi,

By default, the versioning plugin expects your local working copy to be either:

In your case, it is mapped to /trunk/project-group/project hence the failure.

That's a default though, computing the current branch from the working directory. You can also pass the branch name explicitly in the branchEnv, for example:

versioning {
   branchEnv = 'BRANCH_NAME'
}

Then, set the environment locally (for Linux/MacOs):

export BRANCH_NAME=trunk

Not perfect, but as of now, this plugin does a best effort to use a default layout for Subversion, difficult to take into account all possible configurations, especially with Subversion.

Bno93 commented 5 years ago

Thanks for the workaround I will try it ^^

Taeradan commented 5 years ago

I've got the same error when I try to build from a SVN tag. This is blocking in our company as tags are used in our pipeline to build and deliver apps to the production environment.