Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aether-users] SNAPSHOT artifacts: how to best access timestamped files

Hi,

pardon the quite lengthy post this time, but my last question posted
here has taught me that it is better to really describe what you want to
achieve:

We at Eclipse Code Recommenders use Aether to download the data-mined
models required for intelligent code completion. The initial
implementation already works quite well. However, in the course of our
current Code Recommenders 2.0 rewrite, we want to make better use of
what Aether already offers (why reinvent the wheel?).

One area we want to improve is periodic updates of models. And SNAPSHOTs
plus an interval-based update policy seem to fit the bill.

Now, when prototyping this approach, I noticed that when resolving a
SNAPSHOT artifact, two copies of the file end up in your local
repository: One has a timestamp in its name, the other the string
"SNAPSHOT".

I don't know exactly why this happens (the ResolveArtifact
aether-demo-snippets exhibits this behavior as well), but the presence
of the timestamped file is great for us; as far as I understand Aether,
the timestamped file won't be overwritten by a newer SNAPSHOT resolved
later, unlike the "SNAPSHOT" file, so all open files are safe (albeit
stale).

There is one minor problem, however:
artifactResult.getArtifact().getFile() points to the "SNAPSHOT" file,
not the timestamped one. Now, artifactResult.getArtifact().getVersion()
has its SNAPSHOT replaced by the timestamp, so it is certainly possible
to reconstruct the path inside the local repository on your own, but
this seems a bit clunky. So, is there a more direct way to get a
java.io.File pointing to the timestamped file?

On a similar note: Is there a way to find out whether an artifact
already exists in the local repository that doesn't either require
reconstructing a path (and thereby hardcoding the knowledge of how a
local repo looks like) or a "fake" artifact resolution in offline mode?

Best wishes,

Andreas
-- 
Codetrails UG (haftungsbeschränkt)
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940


Back to the top