Maven 3 and timestamps - maven

I have various questions regarding Maven 3 and Nexus repository. At our nexus repository I would like to resolve only timestamp dependencies. That is to say I would like to prevent downloading timestapped dependencies to my local repository. And also at my nexus configuration having only latest snapshot jar for a version is totally fine.
My question is regarding timestamped dependencies at nexus and local repository.
Is having only latest Snapshot at repository a good practice? Why or why not?
I have done at my plugin management section of the parent pom of the deploy plugin <uniqueVersion>false</uniqueVersion> but at hudson I still continue to see timestamps at jar like this bundle-service-client-1.0-20110209.145744-25
I have came across a comment at another question,
The timestamped artifacts should never be see inside your local
(~/.m2/repository) repository. If they are, something is wrong.
Why?

Quoting from the relevant section in Maven 3.x Compatibility Notes
The setting false for a distribution
repository has no effect in version 3.x, snapshot artifacts will
always be deployed using a timestamped version.
Also, look at the comments in this nexus jira bug on a nice explanation to your other questions.

Related

Maven different local repositories for SNAPSHOTs and RELEASE artifacts

is it possible in Maven to configure different local repositories for SNAPSHOT and RELEASE artifacts?
The reason I am asking, we are using Jenkins for continuous build for our project. To ensure the consistency (if same artifact is built from different Jenkins jobs because of race condition, we can experience chaotic behavior) before build start, we create a fresh local repository for Jenkins.
Now the problem is, our project is huge, so for every build we have to download lots of dependencies from our Nexus but when you think about it, there is no reason to download every time new the RELEASE artifacts. The RELEASE artifacts don't change from build to build, for ex, Spring 4.5, httpclient 4.0, aspectj 1.8.1 is same for one build to another.
So actually to ensure the consistency, we only should not have the SNAPSHOT dependencies in the repository. If we could have two local repositories one for RELEASE artifacts and the other for SNAPSHOT's, then before every build start, we could delete the SNAPSHOT repository but re-use the local RELEASE repository, which would save me gigabytes of download from Nexus.
I know we can do RELEASE, SNAPSHOT configurations for remote repositories, is it possible to do same sort of configuration for local repositories?
If this is not possible, how would you solve this problem.
There is currently no way to achieve this, and yes, I agree with the sentiment.
A reasonably recent versions of Jenkins' Maven plugin allow you to specify a custom local repository without having to edit a settings.xml file — the option is right there at the job definition screen (in the Advanced section, select Use private Maven repository).
So, what I would do is use this option, and precede the Maven build step with a script that deletes all directories, in the local private repository, which end in -SNAPSHOT.
It's repulsive, but I can't think of any other way.

How can I show the latest artefact version on bitbucket ReadME?

I have a private repository hosted on bitbucket. Every time I release the latest version of the artefact to Nexus, I have to update the Read me which seems very repetitive.
Is there any way/plugin which can publish the latest version of the artefact directly to my repository's overview page (ReadME.md)?
I am using Maven 3+ for building the artefact using Jenkins which publishes all artefacts to Sonatype Nexus.
You can likely use something akin to this to add the file, likely the attach additional resources example: http://www.mojohaus.org/build-helper-maven-plugin/usage.html

How to download artifacts from github using maven?

An old legacy project in my team is being salvaged for any usable part, one of its dependency is play-json_2.10 with a version number 2.2. However since its too old, its missing from all the major repository, including typesafe and sonatype central. The only place i can find it is on github:
https://github.com/mandubian/play-json-alone
I could download it and manually save it to a local maven repo but my team mate won't be able to see it after checking out my commit. Is there a way to make maven downloading from github and put source code somewhere? Thanks a lot.

Maven and ibiblio

I searched a lot in apache documentation and ibiblio.org and I could not find a decent straight answer.
My questions:
When I download a jar using maven dependency (setup in pom), how can I be sure that the file does not change on the remote repository? for example, if I'm using log4j version 1.2.3, downloaded from ibiblio.org (or any other repo for that matter), how can I be sure I'm getting the exact same jar each time?
Does maven delete jars from the local repository? let's assume I'm not clearing the repository at all, will it fill up eventually? or does maven have some kind of mechanism to clear old jars?
In Maven conventions a released version like log4j 1.2.3 will never be changed. It will be left in your locale repository until you manually delete it. It can't be changed by anyone except for the admins on maven central, but i suppose they don't do such a stupid thing.
Furthermore the download by default is done from maven central (repo1.maven.org/maven2 instead of ibiblio).
One of the "tricks" in Maven is download an artifact (released) only once...that improved your build performance in contradiction to the SNAPSHOT dependencies.
You could configure your own repository, and point all your project poms at that. It's easy to configure your poms to use a different (private) repository, but I've never set one up myself. Doesn't seem too hard, other than managing it to keep all the needed artifacts available.

Artifactory generates different filename

I have a little problem that´s occurs in my computer, when I make deploy to artifactory, the name of the library changes as follows:
servico-disponibilizacao-2.0.0.0-20120117.194415-1.ear
In my project on Eclipse, I can see normally how this is:
servico-disponibilizacao-2.0.0.0-SNAPSHOT.ear
I really don´t know how to fix this, anyone have some ideia?
Thank´s so much for any help!
When publishing to a snapshot repository Maven will substitute the "SNAPSHOT" part of the revision with a timestamp, to create a unique version for that build.
See the Maven documentation on the distributionManagement section of your POM.
Additionally checkout this answer:
Maven Snapshot Repository vs Release Repository
Update
The Nexus book has a section describing the differences in artifact handling between snapshot and release repositories. I should think this information also applies to Artifactory, considering Nexus is the reference Maven repository manager.

Resources