snapshotRepository element is available only in distributionManagement
(see maven pom XSD here http://maven.apache.org/xsd/maven-4.0.0.xsd )
and in it you define destination repository where snapshots of your
project should be released - it has nothing to do with resolving
dependencies tho. For snapshot dependencies including parent pom
references to be resolved you need to define a dependency repository
with snapshots enabled. E.g. [1] worked for me with maven 3.0.2 and
I'm pretty sure you won't have problems resolving dependencies (parent
or regular) with this configuration with maven 2.2.1 either.

Regards,
Stevo.


[1] pom.xml with apache.snapshots dependency repository defined

<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-parent</artifactId>
    <version>19-SNAPSHOT</version>
  </parent>
  <groupId>foo</groupId>
  <artifactId>bar</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <repositories>
    <repository>
      <id>apache.snapshots.https</id>
      <name>Apache Development Snapshot Repository</name>
      <url>https://repository.apache.org/content/repositories/snapshots</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
</project>


On Sun, Feb 27, 2011 at 3:47 PM, sebb <[email protected]> wrote:
> On 27 February 2011 13:41, Stevo Slavić <[email protected]> wrote:
>> I doubt it is intentional behavior. You didn't mention which version
>> of maven are you using, or maven-dependency-plugin - like with any OSS
>> project, latest maven is the greatest, and configure plugin version in
>> pluginManagement section. You also didn't provide snapshots repository
>> definition snippet - maybe you're affected by default daily
>> updatePolicy for snapshots; configure "always" or use -U switch when
>> building.
>
> I'm using Maven 2.2.1
> dependency plugin 2.0
>
> Not sure how I can update the plugin version (there is a 2.2), as it
> appears that Maven tries to process the parent before it processes the
> pluginManagement section.
>
> <snapshotRepository>
>  <id>apache.snapshots.https</id>
>  <name>Apache Development Snapshot Repository</name>
>  <url>https://repository.apache.org/content/repositories/snapshots</url>
> </snapshotRepository>
>
> I don't think the update policy is relevant, otherwise why would a
> plain dependency work?
> Anyway, I have just tried -U and that did not help
>
> Here is the parent.xml file in case you want to try for yourself:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd";>
>  <modelVersion>4.0.0</modelVersion>
>    <parent>
>        <groupId>org.apache.commons</groupId>
>        <artifactId>commons-parent</artifactId>
>        <version>19-SNAPSHOT</version>
>    </parent>
>
>  <groupId>org.home.mvnsample</groupId>
>  <artifactId>mvnsample</artifactId>
>  <packaging>jar</packaging>
>  <version>1.0-SNAPSHOT</version>
>  <name>mvnsample</name>
>  <url>http://maven.apache.org</url>
> </project>
>
>> Regards,
>> Stevo.
>>
>> On Sun, Feb 27, 2011 at 2:44 AM, sebb <[email protected]> wrote:
>>> I uploaded commons-parent POM 19-SNAPSHOT to the snapshot repo [1],
>>> and then deleted it from my local repo (because I want to test how it
>>> will work for others).
>>>
>>> When I try to depend on it as a parent, i.e.
>>>
>>>    <parent>
>>>        <groupId>org.apache.commons</groupId>
>>>        <artifactId>commons-parent</artifactId>
>>>        <version>19-SNAPSHOT</version>
>>>    </parent>
>>>
>>> I get the following error:
>>>
>>> [INFO] Scanning for projects...
>>> [INFO] 
>>> ------------------------------------------------------------------------
>>> [ERROR] FATAL ERROR
>>> [INFO] 
>>> ------------------------------------------------------------------------
>>> [INFO] Error building POM (may not be this project's POM).
>>>
>>> Project ID: org.home.mvnsample:mvnsample:jar:1.0-SNAPSHOT
>>>
>>> Reason: Cannot find parent: org.apache.commons:commons-parent for
>>> project: org.home.mvnsample:mvnsample:jar:1.0-SNAPSHOT for project
>>> org.home.mvnsample:mvnsample:jar:1.0-
>>> SNAPSHOT
>>>
>>> Yet when the POM depends on it as a dependency, i.e.
>>>
>>>    <dependency>
>>>      <groupId>org.apache.commons</groupId>
>>>      <artifactId>commons-parent</artifactId>
>>>      <version>19-SNAPSHOT</version>
>>>      <type>pom</type>
>>>    </dependency>
>>>
>>> it is downloaded without a problem.
>>>
>>> It looks as though Maven does not check snapshot repositories for a
>>> parent POM dependency.
>>> Is this true, and if so is it intentional?
>>>
>>> [1] 
>>> http://repository.apache.org/snapshots/org/apache/commons/commons-parent/19-SNAPSHOT/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

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

Reply via email to