You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ilya Basin <ba...@gmail.com> on 2010/11/25 12:59:05 UTC

use version of some dependency for another dependency

Hi. A project indirectly depends on foo-api.jar via some meta artifact
foo-client.
I know the version of this meta artifact, but not the version of
foo-api.jar.
There's also foo-impl.jar that depends on foo-api.jar with the same
version. For example, if foo-client 1.3 depends on foo-api 1.1, I need
to depend on foo-impl 1.1

Now I need to add the foo-impl.jar to my dependencies, and it must be
the same version as foo-api.jar. How?

<dependencies>
    <dependency>
        <groupId>org.foo</groupId>
        <artifactId>foo-client</artifactId>
        <type>pom</type>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>org.foo</groupId>
        <artifactId>foo-impl</artifactId>
        <version>${version-of-foo-api?}</version>
    </dependency>




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


Re: Re[2]: use version of some dependency for another dependency

Posted by Gérald Quintana <ge...@gmail.com>.
foo-impl:1.2.3 should depend on foo-api:1.2.3. Then add a dependency
on foo-impl:1.2.3, and you'll get a dependency on foo-api:1.2.3.

Gérald

2010/11/25 Ilya Basin <ba...@gmail.com>:
> WS> Set a property elsewhere in the pom (or further up the hierarchy) and
> WS> use that for both versions:  ${foo.version}
>
> I don't know the version of foo-api and foo-impl.
>
> --
>
>
> ---------------------------------------------------------------------
> 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: Re[2]: use version of some dependency for another dependency

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Nov 25, 2010 at 7:49 AM, Ilya Basin <ba...@gmail.com> wrote:
> WS> Set a property elsewhere in the pom (or further up the hierarchy) and
> WS> use that for both versions:  ${foo.version}
>
> I don't know the version of foo-api and foo-impl.

If your project code depends on it, you need to know.

If it's a transitive dependency, then it should be in the pom for the
project you depend on, and you won't need to worry about it --
complain to the developers of *that* project until they fix their pom.
 (How are they compiling if it's not in there?  Is it an optional
dependency?)

-- 
Wendy

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


Re[2]: use version of some dependency for another dependency

Posted by Ilya Basin <ba...@gmail.com>.
WS> Set a property elsewhere in the pom (or further up the hierarchy) and
WS> use that for both versions:  ${foo.version}

I don't know the version of foo-api and foo-impl.

-- 


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


Re: use version of some dependency for another dependency

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Nov 25, 2010 at 6:59 AM, Ilya Basin <ba...@gmail.com> wrote:

> Now I need to add the foo-impl.jar to my dependencies, and it must be
> the same version as foo-api.jar. How?

Set a property elsewhere in the pom (or further up the hierarchy) and
use that for both versions:  ${foo.version}

You'll see this in various open source projects for things like Spring
which have a lot of pieces.  As an example, search for 'properties' in
this pom:  http://svn.apache.org/repos/asf/archiva/trunk/pom.xml

-- 
Wendy

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