You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by As...@putnam.com on 2011/10/01 00:34:20 UTC

Dependency properties defined in settings.xml are not being resolved.

Using Maven 2.2.1
I have defined a profile in my settings.xml file, and specified some
properties. This profile is also listed as an active profile.

For example:
            <profile>
                  <id>third-party-lib-versions</id>
                  <properties>
                        <log4j.version>1.2.16</log4j.version>
                  </properties>
            </profile>
            <activeProfiles>
                  <activeProfile>third-party-lib-versions</activeProfile>
            </activeProfiles>

Then I have a dependency in my pom, which references the property:

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>

In most cases Maven 2.2.1 will inject the property just fine. But it seems
to also end up creating a $M2_REPO/log4j/log4j/${log4j.version}, and when I
run "mvn test", it complains
[INFO] Unable to find resource 'log4j:log4j:pom:${log4j.version}' in
repository central (xxx)

Is there something else that I need to do to ensure that properties defined
in settings.xml are always processed ?

Thanks
Aspi Engineer
Putnam Investments



This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction. Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of Putnam Investments, LLC (DBA Putnam Investments) and its subsidiaries and affiliates. If you are not the intended recipient of this e-mail, please delete the e-mail.

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


Re: Dependency properties defined in settings.xml are not being resolved.

Posted by Maxime Gréau <gr...@gmail.com>.
Hi,

The best practice is to always define the default value for a property in a
parent pom. Then you can use settings.xml (local or global) to override this
property.

In your specific case, when the problem appears, you can execute the
followings goals :
1) mvn help:effective-settings to see the content of the settings file that
Maven is using
2) mvn help:active-profiles to see if your profile is active

Regards

Maxime Gréau.
mgreau.com
*Auteur du livre **Apache Maven - Maîtrisez l'infrastructure d'un projet
Java EE* <http://mvnbook.mgreau.com/>



2011/10/1 <As...@putnam.com>

>
> Using Maven 2.2.1
> I have defined a profile in my settings.xml file, and specified some
> properties. This profile is also listed as an active profile.
>
> For example:
>            <profile>
>                  <id>third-party-lib-versions</id>
>                  <properties>
>                        <log4j.version>1.2.16</log4j.version>
>                  </properties>
>            </profile>
>            <activeProfiles>
>                  <activeProfile>third-party-lib-versions</activeProfile>
>            </activeProfiles>
>
> Then I have a dependency in my pom, which references the property:
>
>        <dependency>
>            <groupId>log4j</groupId>
>            <artifactId>log4j</artifactId>
>            <version>${log4j.version}</version>
>        </dependency>
>
> In most cases Maven 2.2.1 will inject the property just fine. But it seems
> to also end up creating a $M2_REPO/log4j/log4j/${log4j.version}, and when I
> run "mvn test", it complains
> [INFO] Unable to find resource 'log4j:log4j:pom:${log4j.version}' in
> repository central (xxx)
>
> Is there something else that I need to do to ensure that properties defined
> in settings.xml are always processed ?
>
> Thanks
> Aspi Engineer
> Putnam Investments
>
>
>
> This message is intended for the recipient only and is not meant to be
> forwarded or distributed in any other format. This communication is for
> informational purposes only. It is not intended as an offer or solicitation
> for the purchase or sale of any financial instrument, or security, or as an
> official confirmation of any transaction. Putnam does not accept purchase or
> redemptions of securities, instructions, or authorizations that are sent via
> e-mail. All market prices, data and other information are not warranted as
> to completeness or accuracy and are subject to change without notice. Any
> comments or statements made herein do not necessarily reflect those of
> Putnam Investments, LLC (DBA Putnam Investments) and its subsidiaries and
> affiliates. If you are not the intended recipient of this e-mail, please
> delete the e-mail.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>