Reputation: 42602
I am using Linux system.
Under my local maven repo directory /Users/username/.m2/repository/
I have the following directory:
com/amazonaws/android/core/amazon-aws-android-core/1.6.1
Which means the full path of the directory is:
/Users/username/.m2/repository/com/amazonaws/android/core/amazon-aws-android-core/1.6.1
Under the above directory, I have files:
amazon-aws-android-core-1.6.1.jar.lastUpdated
amazon-aws-android-core-1.6.1.pom.lastUpdated
In my project, my pom.xml
contains :
<dependency>
<groupId>com.amazonaws.android.core</groupId>
<artifactId>amazon-aws-android-core</artifactId>
<version>1.6.1</version>
<type>jar</type>
</dependency>
But when I run mvn clean install
, I always get the following error message:
The following artifacts could not be resolved: com.amazonaws.android.core:amazon-aws-android-core:jar:1.6.1
Why I get the above error & How to get rid of it?
Upvotes: 3
Views: 2178
Reputation: 56
You get the above error because the actual .jar file is not in your repository. The .lastUpdated files are not the actual .jar files, and the latest updated version of them. The .lastUpdated files are just book-keeping files.
For example, let's create a nonsense dependency:
<dependency>
<groupId>asdfasdf</groupId>
<artifactId>sadffweklsfduasfsdjf</artifactId>
<version>1.0</version>
</dependency>
and run mvn install
on it.
Maven then creates the directory ~/.m2/repository/asdfasdf/sadffweklsfduasfsdjf/1.0
and populates it with the sadffweklsfduasfsdjf-1.0.jar.lastUpdated
and sadffweklsfduasfsdjf-1.0.pom.lastUpdated
files.
Inside one of the .lastUpdated files, you simply find something like:
1 #NOTE: This is an Aether internal implementation file, its format can be ch anged without prior notice.
2 #Fri Jan 03 09:12:05 IST 2014
3 http\://repo.maven.apache.org/maven2/.lastUpdated=1388733125394
4 http\://repo.maven.apache.org/maven2/.error=
and not the actual .jar or .pom file.
To get rid of this error, you need to make sure that Maven is actually able to reach the remote repository and download the actual Amazon AWS jar that you need.
Upvotes: 2
Reputation: 11
The .lastUpdated files are metadata files, not the actual jar and pom. The situation indicates that you probably attempted to download these while not connected to the network or while the repo was unavailable and now Maven will not attempt to download those again until a certain amount of time has past. You could add the -U switch to your command to force a check for updated release on remote repositories. You could also just delete the folder for that artifact from your local repository which would also cause Maven to try to download it again.
There is a similar question here: Maven downloads have .lastUpdated as extension and here Maven dependencies in local REPO have .lastUpdated extension
And some discussion of the lastUpdated files here: http://maven.40175.n5.nabble.com/Maven-3-maven-repositories-and-lastUpdated-td4927537.html
Upvotes: 1