You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Neimoidia <ne...@endspace.com> on 2008/04/03 06:26:48 UTC

Using a dynamic property for setting the dependency scope

Hi,
depending on which plateform i build my projects, i need to change the scope
of some dependencies.
For dev, i need to build WARs with full jars dependency included. So the
scope must be compiled.
For integration/production, i need to excluded some jars of the WARs as they
will be exposed on the commons/lib of the JOnaAS server (scope provided).

In order to manage this dual setup, i add in my parent pom a property who
setup the scope to provided by default:
    <properties>
        <my.scope>provided</my.scope>
    </properties>

Then, i have created a profile for development:
    <profiles>
        <profile>
            <id>envdev</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/config</directory>
                    </resource>
                    <resource>
                        <directory>src/main/resources</directory>
                    </resource>
                </resources>
            </build>
            <properties>
                <my.scope>compile</my.scope>
            </properties>
        </profile>
    </profiles>

Finally, this setup doesnt seems to work: i have a compilation failure
during the WARs build (missing classes). If i hardcode the scope to compiled
in the pom of the WAR, and relaunch the build, everything goes fine.

Do you have an idea on what's going wrong?
Thks,

PS: i use the <scope>${my.scope}</scope> tag only into the pom of the WARs
projects, not on the JARs projects themselves where the scope is compiled by
default.

Re: Using a dynamic property for setting the dependency scope

Posted by Stephen Connolly <st...@gmail.com>.
As I said, the proptery interpolation is only an "As Far As I Know".

Others will be able to confirm or deny

On Thu, Apr 3, 2008 at 6:16 AM, Neimoidia <ne...@endspace.com> wrote:

> Thks for your answer.
> I know i can add dependencies into splited profiles, but this was the last
> solution i want to use, because it cause me a lot of rewriting and
> management works (around 170 projects under maven control).
> What a pity scope does not support property expansion...
> Regards.
>
> 2008/4/3, Stephen Connolly <st...@gmail.com>:
> >
> > I would add the dependencies with their scopes in the profiles.
> >
> > You do know you can add dependencies in a profile?
> >
> > AFAIK the scope tag does not support property expansion
> >
> >
> > On Thu, Apr 3, 2008 at 5:26 AM, Neimoidia <ne...@endspace.com>
> wrote:
> >
> > > Hi,
> > > depending on which plateform i build my projects, i need to change the
> > > scope
> > > of some dependencies.
> > > For dev, i need to build WARs with full jars dependency included. So
> the
> > > scope must be compiled.
> > > For integration/production, i need to excluded some jars of the WARs
> as
> > > they
> > > will be exposed on the commons/lib of the JOnaAS server (scope
> > provided).
> > >
> > > In order to manage this dual setup, i add in my parent pom a property
> > who
> > > setup the scope to provided by default:
> > >    <properties>
> > >        <my.scope>provided</my.scope>
> > >    </properties>
> > >
> > > Then, i have created a profile for development:
> > >    <profiles>
> > >        <profile>
> > >            <id>envdev</id>
> > >            <activation>
> > >                <os>
> > >                    <family>Windows</family>
> > >                </os>
> > >            </activation>
> > >            <build>
> > >                <resources>
> > >                    <resource>
> > >                        <directory>src/main/config</directory>
> > >                    </resource>
> > >                    <resource>
> > >                        <directory>src/main/resources</directory>
> > >                    </resource>
> > >                </resources>
> > >            </build>
> > >            <properties>
> > >                <my.scope>compile</my.scope>
> > >            </properties>
> > >        </profile>
> > >    </profiles>
> > >
> > > Finally, this setup doesnt seems to work: i have a compilation failure
> > > during the WARs build (missing classes). If i hardcode the scope to
> > > compiled
> > > in the pom of the WAR, and relaunch the build, everything goes fine.
> > >
> > > Do you have an idea on what's going wrong?
> > > Thks,
> > >
> > > PS: i use the <scope>${my.scope}</scope> tag only into the pom of the
> > WARs
> > > projects, not on the JARs projects themselves where the scope is
> > compiled
> > > by
> > > default.
> > >
> >
>

Re: Using a dynamic property for setting the dependency scope

Posted by Neimoidia <ne...@endspace.com>.
Thks for your answer.
I know i can add dependencies into splited profiles, but this was the last
solution i want to use, because it cause me a lot of rewriting and
management works (around 170 projects under maven control).
What a pity scope does not support property expansion...
Regards.

2008/4/3, Stephen Connolly <st...@gmail.com>:
>
> I would add the dependencies with their scopes in the profiles.
>
> You do know you can add dependencies in a profile?
>
> AFAIK the scope tag does not support property expansion
>
>
> On Thu, Apr 3, 2008 at 5:26 AM, Neimoidia <ne...@endspace.com> wrote:
>
> > Hi,
> > depending on which plateform i build my projects, i need to change the
> > scope
> > of some dependencies.
> > For dev, i need to build WARs with full jars dependency included. So the
> > scope must be compiled.
> > For integration/production, i need to excluded some jars of the WARs as
> > they
> > will be exposed on the commons/lib of the JOnaAS server (scope
> provided).
> >
> > In order to manage this dual setup, i add in my parent pom a property
> who
> > setup the scope to provided by default:
> >    <properties>
> >        <my.scope>provided</my.scope>
> >    </properties>
> >
> > Then, i have created a profile for development:
> >    <profiles>
> >        <profile>
> >            <id>envdev</id>
> >            <activation>
> >                <os>
> >                    <family>Windows</family>
> >                </os>
> >            </activation>
> >            <build>
> >                <resources>
> >                    <resource>
> >                        <directory>src/main/config</directory>
> >                    </resource>
> >                    <resource>
> >                        <directory>src/main/resources</directory>
> >                    </resource>
> >                </resources>
> >            </build>
> >            <properties>
> >                <my.scope>compile</my.scope>
> >            </properties>
> >        </profile>
> >    </profiles>
> >
> > Finally, this setup doesnt seems to work: i have a compilation failure
> > during the WARs build (missing classes). If i hardcode the scope to
> > compiled
> > in the pom of the WAR, and relaunch the build, everything goes fine.
> >
> > Do you have an idea on what's going wrong?
> > Thks,
> >
> > PS: i use the <scope>${my.scope}</scope> tag only into the pom of the
> WARs
> > projects, not on the JARs projects themselves where the scope is
> compiled
> > by
> > default.
> >
>

Re: Using a dynamic property for setting the dependency scope

Posted by Stephen Connolly <st...@gmail.com>.
I would add the dependencies with their scopes in the profiles.

You do know you can add dependencies in a profile?

AFAIK the scope tag does not support property expansion

On Thu, Apr 3, 2008 at 5:26 AM, Neimoidia <ne...@endspace.com> wrote:

> Hi,
> depending on which plateform i build my projects, i need to change the
> scope
> of some dependencies.
> For dev, i need to build WARs with full jars dependency included. So the
> scope must be compiled.
> For integration/production, i need to excluded some jars of the WARs as
> they
> will be exposed on the commons/lib of the JOnaAS server (scope provided).
>
> In order to manage this dual setup, i add in my parent pom a property who
> setup the scope to provided by default:
>    <properties>
>        <my.scope>provided</my.scope>
>    </properties>
>
> Then, i have created a profile for development:
>    <profiles>
>        <profile>
>            <id>envdev</id>
>            <activation>
>                <os>
>                    <family>Windows</family>
>                </os>
>            </activation>
>            <build>
>                <resources>
>                    <resource>
>                        <directory>src/main/config</directory>
>                    </resource>
>                    <resource>
>                        <directory>src/main/resources</directory>
>                    </resource>
>                </resources>
>            </build>
>            <properties>
>                <my.scope>compile</my.scope>
>            </properties>
>        </profile>
>    </profiles>
>
> Finally, this setup doesnt seems to work: i have a compilation failure
> during the WARs build (missing classes). If i hardcode the scope to
> compiled
> in the pom of the WAR, and relaunch the build, everything goes fine.
>
> Do you have an idea on what's going wrong?
> Thks,
>
> PS: i use the <scope>${my.scope}</scope> tag only into the pom of the WARs
> projects, not on the JARs projects themselves where the scope is compiled
> by
> default.
>