Max
Max

Reputation: 2162

Maven scm and svn

I am having trouble accessing the svn revision number through Maven. The only real help I've received from the SCM usage page is the following:

<scm>
    <connection>scm:svn:http://somerepository.com/svn_repo/trunk</connection>
    <developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection>
    <tag>HEAD</tag>
    <url>http://somerepository.com/view.cvs</url>
</scm>

This means nothing to me as I can't figure out what connection, developerConnection, and url mean. I simply plugged in the url to my repo for all 3 elements. I also don't know why Maven does not ask me for the username and password for the repository.

I am very new to Maven and might be asking a very basic question but would appreciate a full explanation as to how I am to access the svn repo.

Upvotes: 2

Views: 3238

Answers (2)

Premraj
Premraj

Reputation: 74661

SCM (Software Configuration Management, also called Source Code/Control Management or, succinctly, version control) is an integral part of any healthy project. If your Maven project uses an SCM system (it does, doesn't it?) then here is where you would place that information into the POM.

connection, developerConnection: The two connection elements convey to how one is to connect to the version control system through Maven. Where connection requires read access for Maven to be able to find the source code (for example, an update), developerConnection requires a connection that will give write access. The Maven project has spawned another project named Maven SCM, which creates a common API for any SCMs that wish to implement it. The most popular are CVS and Subversion, however, there is a growing list of other supported SCMs. All SCM connections are made through a common URL structure.

scm:[provider]:[provider_specific]

Where provider is the type of SCM system. For example, connecting to a CVS repository may look like this:

scm:svn:https://somerepository.com/svn_repo/trunk

tag: Specifies the tag that this project lives under. HEAD (meaning, the SCM root) should be the default.

url: A publicly browsable repository. For example, via ViewCVS.

Source

Analogy : https://www.youtube.com/watch?v=9In7ysQJGBs

Upvotes: 0

tmarwen
tmarwen

Reputation: 16374

First I would begin by clarifying the usage of Maven which seems to cause the confusion in your case:

Apache Maven is a software project management tool... that can manage the project's build.

Apache Maven has nothing to do with your revisions being pushed to your source code management system (SVN in your case).

Typically, you'll be pushing your changes through an IDE (Eclipse, IntelliJ IDEA and alike) or through a command line to your SVN repository and you won't in any way be pushing those changes through Maven in which case you'll be breaking its usage purpose.

Now comes the question, why you may need then those SCM related properties? The answer is simple and should be relevant since Maven is a project build tool, it must handle your project release cycle which is final piece of the project build cycle... And it won't be able to do it in coherent way without updating your remote project informations since you are using an SCM remote repository.

Now back to those SCM related properties, and what do they mean:

  • connection: an URL connection endpoint to your SCM repository and which will only used for read access.
  • developerConnection: an URL connection endpoint to your SCM repository and which will be used for write access. (That's what a developer role is intended to do after all, push changes to the repository).
  • tag: it specifies the tag under which the project lives and I've seen only HEAD being used in there and assume would be the default.
  • url: it specifies a browsable repository, such as the one going through viewvc (In most cases you can replace the /svn/ path under your connection URL with /viewvc/)

Upvotes: 1

Related Questions