lightbulb432 wrote:

Could you expand on why there's little point in versioning things in Maven.
I guess maybe I can understand why for the library repository (is it because
it in itself is almost "versioned"?), but what about everything else in
Maven? e.g. your project tree that you're developing with the source code,
configuration files, etc...

One of the core concepts within maven is its version number scheme.

Maven makes a strong distinction between "released" artifacts, and "snapshot" artifacts.

Your project while you are working on it, your dev branch, is an example of a snapshot artifact - despite the fact that it probably has a version number already, every time you rebuild your code, you have replaced your previous "snapshot" build with your new one. Snapshot artifacts have the suffix "-SNAPSHOT" after the version number.

Once you have released a particular tag of your project, you publish it as a "released" artifact, probably into a publically accessible (or publically accessible within your company) maven repository.

Many many other projects have also deployed their "released" artifacts into public maven repositories like http://repo1.maven.org, and this code is automatically available to you as well.

The key point is this: Once an artifact is published with a "released" version number, that artifact never changes again. Should the artifact get updated, a new release is made with a new version number, and the newer released artifact sits beside the older released artifact.

This is why it's largely pointless to place jars in version control, as the jars as released and published don't change and mustn't change.

Of course you could try and subvert the system and upload a replacement jar that replaces an existing released version - the trouble is, maven by design knows that "released" jar files don't change, and if maven has a local copy of the older jar, it will never try and download the new jar.

This is why protecting write access to your maven repository in a corporate environment is generally a good idea, as you don't want a developer changing the goalposts on already released code. This same issue exists even if you do try store jars in version control, because you don't want a developer messing around there for the same reasons.

I'm not sure what you meant by there might be a point to versioning
everything in Maven using source control "only when you version control
server can behave like a webserver"

maven (to my knowledge) expects a "maven repository" to be either a directory local on the machine, or published on a webserver. In order to host a maven repository inside a version control server, the version control server must behave like a webserver, and the only version control server capable of this to my knowledge is subversion.

Don't worry too much about this point - it was an aside.

Regards,
Graham
--

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to