Quantcast

Issue with mvn3 timestamp snapshots being downloaded in local repository

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
It's my understanding that timestamp snapshots should only exist in remote snapshot repositories and are created when doing a mvn deploy.

What I see though is timestamp snapshots downloaded into my local repository when doing mvn install.

Here the test case:
artifact a (jar) depends on artifact b (jar) both are snapshots and they both inherit from maven's default super pom (i.e. no company's super pom is used). also they have different groupId.

I first deploy artifact a, then pretending to be a different developer I delete artifact from my local repository and install artifact b, I now see artifact a timestamp snapshot (a-1.0.0-20110302.155002-4.jar) downloaded in my local repository.

If a deploy several times artifact a and each time install artifact b, I end up with several timestamp snapshots in my local repository (a-1.0.0-20110302.155504-8.jar, a-1.0.0-20110302.155739-11.jar, a-1.0.0-20110302.160157-17.jar).

Also to be noted the jumps in the version of the timestamp (4, 8, 11, 17), although the remote snapshot repository contains all the versions from 4 up to 17.

Is this the intended behavior in mvn 3, a bug or something I missed?

Using:
mvn 3.0.2
nexus 1.9.0.1
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Benjamin Bentmann
Yann Albou wrote:

> It's my understanding that timestamp snapshots should only exist in remote
> snapshot repositories and are created when doing a mvn deploy.
>
> What I see though is timestamp snapshots downloaded into my local repository
> when doing mvn install.

True is that "mvn install" of project A generates no timestamped
artifact for A. But when resolving dependency B from a remote
repository, the timestamped file for B is retrieved and retained with
the timestamped version in the local repository. So what you describe is
normal and has been like this since Maven 2.x

> Also to be noted the jumps in the version of the timestamp (4, 8, 11, 17),
> although the remote snapshot repository contains all the versions from 4 up
> to 17.

Maven just downloads the version that was deemed latest at the time it
was resolved.


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
> So what you describe is normal and has been like this since Maven 2.x

With Maven 2 we used unique snapshot versions.

The issue with Maven 3 is that developers local repositories might grow significantly since several timestamp snapshots are downloaded.

Also we don't have a mechanism to purge the local repositories as we do on the remote repository with Nexus, or does maven provide one I don't know of?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Benjamin Bentmann
Yann Albou wrote:

> Also we don't have a mechanism to purge the local repositories as we do on
> the remote repository with Nexus, or does maven provide one I don't know of?

http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Jörg Schaible-3
In reply to this post by Yann Albou
Hi Yann,

Yann Albou wrote:

>> So what you describe is normal and has been like this since Maven 2.x
>
> With Maven 2 we used unique snapshot versions.
>
> The issue with Maven 3 is that developers local repositories might grow
> significantly since several timestamp snapshots are downloaded.
>
> Also we don't have a mechanism to purge the local repositories as we do on
> the remote repository with Nexus, or does maven provide one I don't know
> of?

Delete all directories in your local repo that end with "-SNAPSHOT".

Under Linux we use actually an alias:

alias repoclean='find `cat ~/.m2/repoclean` -type d -name "*-SNAPSHOT" -
prune -exec rm -rvf \{} +'

with ~/.m2/repoclean containing a list of paths e.g.

/<repopath>/com/yourcompany

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
@benjamin

There are several drawbacks with the maven-dependency-plugin:purge-local-repository:

- Performances slowdown if used systematically, i.e. included in project's pom or worse super pom, due to the downloads from the remote. One benefit of upgrading to maven 3 for us is the performance improvement, this will kill it.

- According to Maven 3 incompatibilities the way dependencies are analyzed has changed and the dependency plugin has not yet been updated, potentially resulting in different set of artifacts being purged than those build https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-DependencyResolution.
I am assuming that all the maven-dependency-plugin goals share the same resolution mechanism as the tree one.

- Leaving it up to the developers, at the expense of putting on them a new thing they didn't had to bother when using Maven 2, at least not so often. Not a selling point for Maven 3 adoption.


@Jörg

Just to clarify, the timestamp artifacts don't end with -SNAPSHOT but with the timestamp like
A-1.0.0-20110302.160157-17.jar.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
I did the test with the new maven 3.0.3 distribution and I still get the same behaviour.

For me, it sounds like a regression compare to Maven 2.
I understand why for deployment this behaviour has been removed so that snapshot artifacts will always be deployed using a timestamped version. But I don't understand why this behaviour has been removed for the dowload of jars in the local repo ?

Thanks
Yann.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Wayne Fay
> snapshot artifacts will always be deployed using a timestamped version. But
> I don't understand why this behaviour has been removed for the dowload of
> jars in the local repo ?

So you're proposing that the Maven client download a snapshot artifact
named A-1.0.0-20110302.160157-17.jar and then rename it to
A-1.0.0-SNAPSHOT.jar when it stores the file locally? This is the
functionality that you want? (I'm making no promises of anything
actually happening in this regard, just trying to understand what it
is that you are asking for.)

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
Yes, maybe
I don't know how was working maven 2 for this, but if it is the simplest way then yes.

Does it sound a reasonnable request/feature ?
thanks
Yann.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Michael Bedward
In reply to this post by Wayne Fay
On 8 March 2011 03:11, Wayne Fay <[hidden email]> wrote:
>
> So you're proposing that the Maven client download a snapshot artifact
> named A-1.0.0-20110302.160157-17.jar and then rename it to
> A-1.0.0-SNAPSHOT.jar when it stores the file locally? This is the
> functionality that you want? (I'm making no promises of anything
> actually happening in this regard, just trying to understand what it
> is that you are asking for.)

+1

Not sure if the OP is asking for that but I'd _really_ like it :)

For a multi-module project where I do regular snapshots users hated
their local repos filling up with daily time-stamped jars. I've been
secretly dreading the flood of complaints that will hit my inbox when
I switch from maven 2 to 3 and the uniqueVersion option isn't
available anymore.

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Jörg Schaible-3
In reply to this post by Yann Albou
Yann Albou wrote:

[snip]
 
> @Jörg
>
> Just to clarify, the timestamp artifacts don't end with -SNAPSHOT but with
> the timestamp like
> A-1.0.0-20110302.160157-17.jar.

To clarify: The script finds and removes the directories and they *are*
named "*-SNAPSHOT"!

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Jörg Schaible-3
In reply to this post by Wayne Fay
Hi Wayne,

Wayne Fay wrote:

>> snapshot artifacts will always be deployed using a timestamped version.
>> But I don't understand why this behaviour has been removed for the
>> dowload of jars in the local repo ?
>
> So you're proposing that the Maven client download a snapshot artifact
> named A-1.0.0-20110302.160157-17.jar and then rename it to
> A-1.0.0-SNAPSHOT.jar when it stores the file locally? This is the
> functionality that you want? (I'm making no promises of anything
> actually happening in this regard, just trying to understand what it
> is that you are asking for.)

At least it would help to build EARs, because the if you have such
dependencies for your EJBs, they are added as timestamped jar to the EJB's
Class-Path entry in its manifest, but later on added as *-SNAPSHOT.jar to
the EAR. This will obviously break the EAR for some app servers.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
@Jörg : we had the same issue with the class-path of the manifest. to resolve it you have to add useUniqueVersions to false to all archives (jar, ejb, war...):
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<configuration>
		<archive>
			<manifest>
				<addClasspath>true</addClasspath>
				<useUniqueVersions>false</useUniqueVersions>
			</manifest>
		</archive>
	</configuration>
</plugin>
@Wayne: Do you need that I create a Jira ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Wayne Fay
> @Wayne: Do you need that I create a Jira ?

That would be the correct next step. But again, I'm not making any
statements as to whether or not this will actually occur. It will need
to be discussed on the Dev list and in the Jira.

I can think of an awful lot of reasons why this should not be
implemented -- for one, changing the file name will break the
manifest.mf in the archive and possibly other similar files. And I'm
not sure the positive side effects of such a change would outweigh the
negative ones.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Patrick Sansoucy
Maybe a bit harder to implement, and to be honest, I have not opened
Maven's hood since the beginning of V2. But why not create the non
timestamped snapshot and meta data on the fly locally from the
timeshot version, but add meta data to make it behave like some sort
of symbolic link/reference to the timestamped version ?

Patrick Sansoucy
In theory, there is no difference between theory and practice, but in
practice, there is ...



On Tue, Mar 8, 2011 at 11:31 AM, Wayne Fay <[hidden email]> wrote:

>> @Wayne: Do you need that I create a Jira ?
>
> That would be the correct next step. But again, I'm not making any
> statements as to whether or not this will actually occur. It will need
> to be discussed on the Dev list and in the Jira.
>
> I can think of an awful lot of reasons why this should not be
> implemented -- for one, changing the file name will break the
> manifest.mf in the archive and possibly other similar files. And I'm
> not sure the positive side effects of such a change would outweigh the
> negative ones.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Jacques Gonzalez
In reply to this post by Wayne Fay
Artifactory (http://www.jfrog.com/products.php) has a solution to Maven 3 timestamped snapshots problem with local repositories.

Artifactory supports the upload of timestamp snapshots but can download artifacts without timestamps to local repositories.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Jacques Gonzalez
Forgot to mention that I'm neither related nor working for to www.jfrog.com - artifactory.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Michael Bedward
In reply to this post by Jacques Gonzalez
Nice - thanks for this Jacques. I didn't know about Artifactory and it
looks very useful plus I can suggest it as a solution to my users who
don't like time-stamped snapshots in their local repos.

Michael

On 9 March 2011 10:25, Jacques Gonzalez <[hidden email]> wrote:
> Artifactory (http://www.jfrog.com/products.php) has a solution to Maven 3
> timestamped snapshots problem with local repositories.
>
> Artifactory supports the upload of timestamp snapshots but can download
> artifacts without timestamps to local repositories.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Yann Albou
In reply to this post by Wayne Fay
Wayne Fay wrote
That would be the correct next step. But again, I'm not making any
statements as to whether or not this will actually occur. It will need
to be discussed on the Dev list and in the Jira.

I can think of an awful lot of reasons why this should not be
implemented -- for one, changing the file name will break the
manifest.mf in the archive and possibly other similar files. And I'm
not sure the positive side effects of such a change would outweigh the
negative ones.
I created the jira http://jira.codehaus.org/browse/MNG-5037
Regarding the break of the manifest.mf it is already the case:
By defaut, and for those that use the class-path entry, the manifest contains references to timestamped jars, but the ear/war contains snapshots jars. So your application won't work.
You can bypass this behaviour by configuring the archiver as I said in my previous post.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Issue with mvn3 timestamp snapshots being downloaded in local repository

Jörg Schaible-3
In reply to this post by Yann Albou
Hi,

Yann Albou wrote:

> @Jörg : we had the same issue with the class-path of the manifest. to
> resolve it you have to add useUniqueVersions to false to all archives
> (jar, ejb, war...):
>
> &lt;plugin&gt;
> &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
> &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
> &lt;configuration&gt;
> &lt;archive&gt;
> &lt;manifest&gt;
> &lt;addClasspath&gt;true&lt;/addClasspath&gt;
> &lt;useUniqueVersions&gt;false&lt;/useUniqueVersions&gt;
> &lt;/manifest&gt;
> &lt;/archive&gt;
> &lt;/configuration&gt;
> &lt;/plugin&gt;

Thanks, never recognized this setting ...

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12
Loading...