You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tonio Caputo <to...@exeo.com.ar> on 2013/02/14 18:11:37 UTC

Settings properties not resolved when used in repository element.

Hi,

I'm trying to be able to configure my project repository URL inside
settings.xml, here the snippet

    <activeProfiles>
        <activeProfile>company.default.profile</activeProfile>
    </activeProfiles>

    <profiles>
        <profile>
            <id>company.default.profile</id>
            <properties>
                <company.maven.repo>
                      http://maven:8080/repo
                </company.maven.repo>
            </properties>
        </profile>
    </profiles>

my pom snippet (for a none module project).

    <repositories>
        <repository>
            <id>company.repo</id>
            <name>Archiva Managed Internal Repository</name>
            <url>${company.maven.repo}</url>
        </repository>
    </repositories>

    <parent>
        <groupId>company.pom</groupId>
        <artifactId>company-pom</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </parent>

when I run my mvn compile command, I get this warning at the very beginning
which implies SNAPSHOT is not updated, and property *company.maven.repo *is
not resolved

[WARNING] *Could not transfer metadata* *
company.pom:company-pom:1.0.1-SNAPSHOT*/maven-metadata.xml *from/to
brovada.repo (${company.maven.repo})*: No connector available to access
repository company.repo (${company.maven.repo}) of type default using the
available factories WagonRepositoryConnectorFactory

If I use this approach in a multi-module project, the message will appear,
but the
SNAPSHOTs will be solved for the modules without any trouble, (repository
entry
is only set in the reactor pom).

My questions (I'm using 3.0.4):

- Am I missing the point here, may be the property should not be resolved
where I
  expect it to be resolved ?

- May be this is a bug ?
  I've seen something similar happening for transitive dependencies version
in
  multi-module projects reported as a bug, but nothing close to this one.


Thanks in advance
tonio

Re: Settings properties not resolved when used in repository element.

Posted by gagantewari <ga...@gmail.com>.
Hi Tonio,

I am facing the same issue. Is this issue resolved? Can you share the
solution.

Thanks!
Gagan



--
View this message in context: http://maven.40175.n5.nabble.com/Settings-properties-not-resolved-when-used-in-repository-element-tp5746974p5867105.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Settings properties not resolved when used in repository element.

Posted by Tonio Caputo <to...@exeo.com.ar>.
Hi Richard,

Thanks for your answer, I think my last example confused everyone :-).

My problem is a bit a different (I think) here it goes again:

*SETTINGS.XML snippet*

    <activeProfiles>
        <activeProfile>company.default.profile</activeProfile>
    </activeProfiles>

    <profiles>
        <profile>
            <id>company.default.profile</id>
            <properties>
*                <company.maven.repo>
                      http://maven:8080/repo
                </company.maven.repo>
*            </properties>
        </profile>
    </profiles>

*POM.XML snippet*

    <repositories>
        <repository>
            <id>company.repo</id>
                        <name>Main Respository</name>
*            <url>${company.maven.repo}</**url>*
        </repository>
    </repositories>

    <parent>
        <groupId>company.pom</groupId>
        <artifactId>company-pom</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </parent>

    <distributionManagement>
        <repository>
             <id>company.repo</id>
             <name>Main Respository</name>
            * <url>dav:${company.maven.repo}</url>*
        </repository>
    </distributionManagement>


How does this work:

*mvn -U -compile*
   I get this warning at the very beginning
   which implies SNAPSHOT is not updated, and property *company.maven.repo *is
not resolved

[WARNING] *Could not transfer metadata* *
company.pom:company-pom:1.0.1-SNAPSHOT*/maven-metadata.xml *from/to
brovada.repo (${company.maven.repo})*: No connector available to access
repository company.repo (${company.maven.repo}) of type default using the
available factories WagonRepositoryConnectorFactory

*mvn deploy*
*   *The company.maven.repo is correctly resolved.

*mvn help:effective-pom*
    **The company.maven.repo is correctly resolved.


So my problem is why does this variable is not resolved when trying to
update snapshots,
is this an expected behaviour ?

thanks in advance
tonio

Re: Settings properties not resolved when used in repository element.

Posted by Richard Seddon <rs...@sonatype.com>.
If I recall correctly, property definitions within a settings.xml profile can't be interpolated outside the profile within the settings.xml.   And the rationale for this was that profile elements are a subset of pom files, not settings.xml files.  

See here for the comment accompanying the original implementation, which says that this was explicitly disallowed:

http://jira.codehaus.org/browse/MNG-2577?focusedCommentId=100862&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-100862

Rich


On Feb 14, 2013, at 5:14 PM, Tonio Caputo <to...@exeo.com.ar> wrote:

> Hi Wayne,
> 
> Thanks for your answer,
> 
> I'll try the _ version tomorrow, and let you know how it worked.
> 
> 
> Regarding your question
> 
>>        <repository>
>>            <id>company.repo</id>
>>            <name>Archiva Managed Internal Repository</name>
>>            <url>${company.maven.repo}</url>
>>        </repository>
> 
>>> What's the reason that you can't simply specify the url here, and
>>> instead are using this property approach?
> 
> You are right, it doesn't make sense in this single sample I've sent, but if
> you read my previous email the idea was to define this property
> *company.maven.repo  *in the *settings.xml*.
> 
> This way you can customize the repo URL for example if you are working
> in the office (local NETWORK) or at home (with a public URL), or easy
> to change if URL changes, or whatever..... :-)
> 
> Using properties, instead of definining the full repository entry
> helps in a couple of ways:
> 
> - if you need to define the same repository in different profiles
>  (to make sure the order in which repositories are searched)
> 
> - Some times repository and distributionManagement (which you cannot define
>  in the settings profile) uses the same URL.
> 
> But of course may be I'm not following a good approach
> 
> Thanks again
> tonio
> 
> 
> 
> 
> 
> 
> On Thu, Feb 14, 2013 at 6:23 PM, Wayne Fay <wa...@gmail.com> wrote:
> 
>>>    <properties>
>>>        <company.maven.repo>http://maven:8080/repo/</company.maven.repo>
>>>    </properties>
>> 
>> Try company_maven_repo instead. I know at one point, there was an
>> issue with dotted properties, but that was a while back.
>> 
>>>        <repository>
>>>            <id>company.repo</id>
>>>            <name>Archiva Managed Internal Repository</name>
>>>            <url>${company.maven.repo}</url>
>>>        </repository>
>> 
>> What's the reason that you can't simply specify the url here, and
>> instead are using this property approach?
>> 
>> Wayne
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Settings properties not resolved when used in repository element.

Posted by Tonio Caputo <to...@exeo.com.ar>.
Hi Wayne,

Thanks for your answer,

I'll try the _ version tomorrow, and let you know how it worked.


Regarding your question

>         <repository>
>             <id>company.repo</id>
>             <name>Archiva Managed Internal Repository</name>
>             <url>${company.maven.repo}</url>
>         </repository>

>> What's the reason that you can't simply specify the url here, and
>> instead are using this property approach?

You are right, it doesn't make sense in this single sample I've sent, but if
you read my previous email the idea was to define this property
*company.maven.repo  *in the *settings.xml*.

This way you can customize the repo URL for example if you are working
in the office (local NETWORK) or at home (with a public URL), or easy
to change if URL changes, or whatever..... :-)

Using properties, instead of definining the full repository entry
helps in a couple of ways:

- if you need to define the same repository in different profiles
  (to make sure the order in which repositories are searched)

- Some times repository and distributionManagement (which you cannot define
  in the settings profile) uses the same URL.

But of course may be I'm not following a good approach

Thanks again
tonio






On Thu, Feb 14, 2013 at 6:23 PM, Wayne Fay <wa...@gmail.com> wrote:

> >     <properties>
> >         <company.maven.repo>http://maven:8080/repo/</company.maven.repo>
> >     </properties>
>
> Try company_maven_repo instead. I know at one point, there was an
> issue with dotted properties, but that was a while back.
>
> >         <repository>
> >             <id>company.repo</id>
> >             <name>Archiva Managed Internal Repository</name>
> >             <url>${company.maven.repo}</url>
> >         </repository>
>
> What's the reason that you can't simply specify the url here, and
> instead are using this property approach?
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Settings properties not resolved when used in repository element.

Posted by Wayne Fay <wa...@gmail.com>.
>     <properties>
>         <company.maven.repo>http://maven:8080/repo/</company.maven.repo>
>     </properties>

Try company_maven_repo instead. I know at one point, there was an
issue with dotted properties, but that was a while back.

>         <repository>
>             <id>company.repo</id>
>             <name>Archiva Managed Internal Repository</name>
>             <url>${company.maven.repo}</url>
>         </repository>

What's the reason that you can't simply specify the url here, and
instead are using this property approach?

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Settings properties not resolved when used in repository element.

Posted by Tonio Caputo <to...@exeo.com.ar>.
Sorry sent an email without completing it, here it goes again.

Seems this is not just a settings.xml way of working,
the same happens if you just define the property in
your pom.

Snippet

    <properties>
        <company.maven.repo>http://maven:8080/repo/</company.maven.repo>
    </properties>

    <repositories>
        <repository>
            <id>company.repo</id>
            <name>Archiva Managed Internal Repository</name>
            <url>${company.maven.repo}</url>
        </repository>
    </repositories>

    <parent>
        <groupId>company.pom</groupId>
        <artifactId>company-pom</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </parent>



So my guess is you cannot configure repositories URL using properties, at
least they
will fail for the reactor or single pom, any ideas will be greatly welcomed

thanks in advance
tonio


On Thu, Feb 14, 2013 at 2:11 PM, Tonio Caputo <to...@exeo.com.ar> wrote:

> Hi,
>
> I'm trying to be able to configure my project repository URL inside
> settings.xml, here the snippet
>
>     <activeProfiles>
>         <activeProfile>company.default.profile</activeProfile>
>     </activeProfiles>
>
>     <profiles>
>         <profile>
>             <id>company.default.profile</id>
>             <properties>
>                 <company.maven.repo>
>                       http://maven:8080/repo
>                 </company.maven.repo>
>             </properties>
>         </profile>
>     </profiles>
>
> my pom snippet (for a none module project).
>
>     <repositories>
>         <repository>
>             <id>company.repo</id>
>             <name>Archiva Managed Internal Repository</name>
>             <url>${company.maven.repo}</url>
>         </repository>
>     </repositories>
>
>     <parent>
>         <groupId>company.pom</groupId>
>         <artifactId>company-pom</artifactId>
>         <version>1.0.1-SNAPSHOT</version>
>     </parent>
>
> when I run my mvn compile command, I get this warning at the very
> beginning
> which implies SNAPSHOT is not updated, and property *company.maven.repo *is
> not resolved
>
> [WARNING] *Could not transfer metadata* *
> company.pom:company-pom:1.0.1-SNAPSHOT*/maven-metadata.xml *from/to
> brovada.repo (${company.maven.repo})*: No connector available to access
> repository company.repo (${company.maven.repo}) of type default using the
> available factories WagonRepositoryConnectorFactory
>
> If I use this approach in a multi-module project, the message will appear,
> but the
> SNAPSHOTs will be solved for the modules without any trouble, (repository
> entry
> is only set in the reactor pom).
>
> My questions (I'm using 3.0.4):
>
> - Am I missing the point here, may be the property should not be resolved
> where I
>   expect it to be resolved ?
>
> - May be this is a bug ?
>   I've seen something similar happening for transitive dependencies
> version in
>   multi-module projects reported as a bug, but nothing close to this one.
>
>
> Thanks in advance
> tonio
>

Re: Settings properties not resolved when used in repository element.

Posted by Tonio Caputo <to...@exeo.com.ar>.
Seems this is not just a settings.xml way of working,
the same happens if you just define the property in
your pom.

Snippet



    <repositories>
        <repository>
            <id>company.repo</id>
            <name>Archiva Managed Internal Repository</name>
            <url>${company.maven.repo}</url>
        </repository>
    </repositories>

    <parent>
        <groupId>company.pom</groupId>
        <artifactId>company-pom</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </parent>


Continue




On Thu, Feb 14, 2013 at 2:11 PM, Tonio Caputo <to...@exeo.com.ar> wrote:

> Hi,
>
> I'm trying to be able to configure my project repository URL inside
> settings.xml, here the snippet
>
>     <activeProfiles>
>         <activeProfile>company.default.profile</activeProfile>
>     </activeProfiles>
>
>     <profiles>
>         <profile>
>             <id>company.default.profile</id>
>             <properties>
>                 <company.maven.repo>
>                       http://maven:8080/repo
>                 </company.maven.repo>
>             </properties>
>         </profile>
>     </profiles>
>
> my pom snippet (for a none module project).
>
>     <repositories>
>         <repository>
>             <id>company.repo</id>
>             <name>Archiva Managed Internal Repository</name>
>             <url>${company.maven.repo}</url>
>         </repository>
>     </repositories>
>
>     <parent>
>         <groupId>company.pom</groupId>
>         <artifactId>company-pom</artifactId>
>         <version>1.0.1-SNAPSHOT</version>
>     </parent>
>
> when I run my mvn compile command, I get this warning at the very
> beginning
> which implies SNAPSHOT is not updated, and property *company.maven.repo *is
> not resolved
>
> [WARNING] *Could not transfer metadata* *
> company.pom:company-pom:1.0.1-SNAPSHOT*/maven-metadata.xml *from/to
> brovada.repo (${company.maven.repo})*: No connector available to access
> repository company.repo (${company.maven.repo}) of type default using the
> available factories WagonRepositoryConnectorFactory
>
> If I use this approach in a multi-module project, the message will appear,
> but the
> SNAPSHOTs will be solved for the modules without any trouble, (repository
> entry
> is only set in the reactor pom).
>
> My questions (I'm using 3.0.4):
>
> - Am I missing the point here, may be the property should not be resolved
> where I
>   expect it to be resolved ?
>
> - May be this is a bug ?
>   I've seen something similar happening for transitive dependencies
> version in
>   multi-module projects reported as a bug, but nothing close to this one.
>
>
> Thanks in advance
> tonio
>