Hi,
I have a project A that depends on an artifact X which is a SNAPSHOT.
Artifact X uses a parent pom X1 which uses a parent pom X2.  Both X1 and X2
are SNAPSHOTs.  Artifact X, X1 and X2 are available from a remote repository
R.

In the pom of project A, I included repository R by defining its id, name
and url.  Artifacts X, X1 and X2 were brought in to my local repository by
running mvn install on the project pom.  I want to be able to stop Maven
from getting updates on artifact X.  On a new day, if I run mvn install in
offline mode, the build fails.  After I build the project in online mode,
subsequent builds on the same day can be run in offline mode.  I did a
couple of tests:

Test 1.
I advanced the date to a day later than today and then ran "mvn -o -e
install".  The build failed and the error was that X was missing.  The error
messages suggested to download X manually from the project site and then
install it using mvn install:install.

Test 2.
In the pom of project A, I added
<snapshots><updatePolicy>never</updatePolicy></snapshots> to respository
section of R.  I advanced the date to a day later and then ran "mvn -o -e
install".  The build failed.  The message thrown by
org.apache.maven.artifact.resolver.ArtifactResolutionException indicated
that it was unable to read the metadata file for artifact X: Cannot find
parent X2 for X1 for X.

It looks like that in Test 1, Maven did not see X to be in my local
repository.  In Test 2, by introducing repository snapshot never update
policy in the project pom, Maven seems to see X and X1 but not X2.

I am fairly new to Maven.  Can someone tell me how to stop Maven to look for
updates on snapshots (or its parent pom)?

Reply via email to