You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jiangshachina <ji...@gmail.com> on 2006/11/30 05:01:56 UTC

adds same artifacts(different version)?

Hi,
I have a Web project.
I declare ehcache-1.2.3.jar as dependency.
But ehcache-1.1.jar is transitive dependency of one of my directly
dependency(acegi-security-1.0.2.jar).
Then I run "mvn clean package", the two jar files are all in WEB-INF/lib.
How to resolve the problem?

More strangely, I changed the POM of artifact acegi-security-1.0.2.jar, and
made it to use ehcache-1.2.3.jar,
But ehcache-1.1.jar still was in WEB-INF/lib.
May ehcache-1.1.jar is other (direct or indirect) dependencies' transitive
denpendency,
but I can't find all.
How to resolve the problem?

Thanks in advance.

a cup of Java, cheers!
Sha Jiang
-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613187
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: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Hello Andrius,
Thanks your help very much!

Now, I find that I made a mistake in my last post.
I really misunderstood Wayne's instructions.
I'll try the approach.

a cup of Java, cheers!
Sha Jiang


Andrius Šabanas wrote:
> 
> jiangshachina wrote:
>> Dear Wayne,
>> I also wish to use the approach you indicated.
>> But in my mind, I cannot exactly set only one artifact(e.g.
>> ehcache-1.1.jar)
>> in <exclusion >,
>> because only there are groupId and artifaceId for setting.
>> If I use the element, I may exclude all ehcache artifacts(1.1, 1.2.3,
>> ...).
>> That's my agony :(
>> 
>> a cup of Java, cheers!
>> Sha Jiang
> 
> Hi,
> 
> Sure you can use the approach - I have the same situation, and I do this:
> 
>        <dependency>
>          <groupId>org.acegisecurity</groupId>
>          <artifactId>acegi-security</artifactId>
>          <version>1.0.2</version>
>          <scope>compile</scope>
>          <exclusions>
>            <exclusion>
>              <groupId>ehcache</groupId>
>              <artifactId>ehcache</artifactId>
>            </exclusion>
>          </exclusions>
>        </dependency>
> 
>        <dependency>
>          <groupId>net.sf.ehcache</groupId>
>          <artifactId>ehcache</artifactId>
>          <version>1.2.3</version>
>        </dependency>
> 
> It works nicely - you exclude only that specific ehcache:ehcache:1.1 
> specified in acegi-security POM from transitive inclusion, but 
> net.sf.ehcache:ehcache:1.2.3 is a completely unrelated artifact, 
> according to Maven.
> 
> 
> Have fun,
> 
> Andrius
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7631787
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: adds same artifacts(different version)?

Posted by Andrius Šabanas <an...@pivotcapital.com>.
jiangshachina wrote:
> Dear Wayne,
> I also wish to use the approach you indicated.
> But in my mind, I cannot exactly set only one artifact(e.g. ehcache-1.1.jar)
> in <exclusion >,
> because only there are groupId and artifaceId for setting.
> If I use the element, I may exclude all ehcache artifacts(1.1, 1.2.3, ...).
> That's my agony :(
> 
> a cup of Java, cheers!
> Sha Jiang

Hi,

Sure you can use the approach - I have the same situation, and I do this:

       <dependency>
         <groupId>org.acegisecurity</groupId>
         <artifactId>acegi-security</artifactId>
         <version>1.0.2</version>
         <scope>compile</scope>
         <exclusions>
           <exclusion>
             <groupId>ehcache</groupId>
             <artifactId>ehcache</artifactId>
           </exclusion>
         </exclusions>
       </dependency>

       <dependency>
         <groupId>net.sf.ehcache</groupId>
         <artifactId>ehcache</artifactId>
         <version>1.2.3</version>
       </dependency>

It works nicely - you exclude only that specific ehcache:ehcache:1.1 
specified in acegi-security POM from transitive inclusion, but 
net.sf.ehcache:ehcache:1.2.3 is a completely unrelated artifact, 
according to Maven.


Have fun,

Andrius


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


Re: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Dear Wayne,
I also wish to use the approach you indicated.
But in my mind, I cannot exactly set only one artifact(e.g. ehcache-1.1.jar)
in <exclusion >,
because only there are groupId and artifaceId for setting.
If I use the element, I may exclude all ehcache artifacts(1.1, 1.2.3, ...).
That's my agony :(

a cup of Java, cheers!
Sha Jiang


Wayne Fay wrote:
> 
> You can certainly use warSourceExcludes but I was actually suggesting
> that you use the /dependencies/dependency/exclusions/exclusion node.
> This is how I handle these types of issues.
> 
> Wayne
> 
> On 11/30/06, jiangshachina <ji...@gmail.com> wrote:
>>
>> Hi Wayne,
>> This time, I used
>> <plugin>
>>    <groupId>org.apache.maven.plugins</groupId>
>>    <artifactId>maven-war-plugin</artifactId>
>>    <version>2.0.1</version>
>>    <configuration>
>>        <warSourceExcludes>WEB-INF/lib/some.jar</warSourceExcludes>
>>    </configuration>
>> </plugin>
>> to excludes the jar files by hard way.
>>
>> > Alternatively since it sounds like you are already changing poms in
>> > your repo (not generally a good idea imo)
>> I agree with you, so finally, I don't use the approach.
>>
>> a cup of Java, cheers!
>> Sha Jiang
>>
>>
>> Wayne Fay wrote:
>> >
>> > There is no "shortcut" per se. You need to find each such situation
>> > and explicitly exclude the old/invalid artifact and explicitly add the
>> > proper/new artifact to your dependency list.
>> >
>> > Alternatively since it sounds like you are already changing poms in
>> > your repo (not generally a good idea imo), you could just change the
>> > dependency directly in the associated project pom files. Then when you
>> > simply refer to acegi, it will pull in the newer ehcache directly.
>> >
>> > Wayne
>> >
>> > On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>> >>
>> >> Oh,
>> >> Sorry, I made a mistake,
>> >> acegi-security-parent declaration is the following
>> >> <dependency>
>> >>    <groupId>ehcache</groupId>
>> >>    <artifactId>ehcache</artifactId>
>> >>    <version>1.1</version>
>> >>    <optional>true</optional>
>> >> </dependency>
>> >>
>> >>
>> >> a cup of Java, cheers!
>> >> Sha Jiang
>> >>
>> >>
>> >> jiangshachina wrote:
>> >> >
>> >> > Hi Wendy,
>> >> > You are right.
>> >> > My declaration,
>> >> > <dependency>
>> >> >       <groupId>net.sf.ehcache</groupId>
>> >> >       <artifactId>ehcache</artifactId>
>> >> >       <version>1.2.3</version>
>> >> > </dependency>
>> >> >
>> >> > But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets
>> the
>> >> > following,
>> >> > <dependency>
>> >> >     <groupId>net.sf.ehcache</groupId>
>> >> >     <artifactId>ehcache</artifactId>
>> >> >     <version>1.1</version>
>> >> >     <optional>true</optional>
>> >> > </dependency>
>> >> > May there are many similar cases, how can I cancel the trouble?
>> >> >
>> >> > Thanks in advance!
>> >> >
>> >> > a cup of Java, cheers!
>> >> > Sha Jiang
>> >> >
>> >> >
>> >> > Wendy Smoak-3 wrote:
>> >> >>
>> >> >> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>> >> >>> I have a Web project.
>> >> >>> I declare ehcache-1.2.3.jar as dependency.
>> >> >>> But ehcache-1.1.jar is transitive dependency of one of my directly
>> >> >>> dependency(acegi-security-1.0.2.jar).
>> >> >>> Then I run "mvn clean package", the two jar files are all in
>> >> >>> WEB-INF/lib.
>> >> >>> How to resolve the problem?
>> >> >>
>> >> >> When you say you declare a dependency, we need to see the whole
>> thing:
>> >> >>  groupId, artifactId, and version.
>> >> >>
>> >> >> My guess is that your EHCache jars are coming from two different
>> >> >> groupIds, so Maven can't figure out that they are the same.
>> >> >>
>> >> >> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
>> >> >> http://repo1.maven.org/maven2/ehcache/ehcache/
>> >> >>
>> >> >> The output of "mvn clean install -X" should help you figure out
>> where
>> >> >> each one is coming from.
>> >> >>
>> >> >> --
>> >> >> Wendy
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> >> For additional commands, e-mail: users-help@maven.apache.org
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613552
>> >> 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
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7614503
>> 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
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7616252
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: adds same artifacts(different version)?

Posted by Wayne Fay <wa...@gmail.com>.
You can certainly use warSourceExcludes but I was actually suggesting
that you use the /dependencies/dependency/exclusions/exclusion node.
This is how I handle these types of issues.

Wayne

On 11/30/06, jiangshachina <ji...@gmail.com> wrote:
>
> Hi Wayne,
> This time, I used
> <plugin>
>    <groupId>org.apache.maven.plugins</groupId>
>    <artifactId>maven-war-plugin</artifactId>
>    <version>2.0.1</version>
>    <configuration>
>        <warSourceExcludes>WEB-INF/lib/some.jar</warSourceExcludes>
>    </configuration>
> </plugin>
> to excludes the jar files by hard way.
>
> > Alternatively since it sounds like you are already changing poms in
> > your repo (not generally a good idea imo)
> I agree with you, so finally, I don't use the approach.
>
> a cup of Java, cheers!
> Sha Jiang
>
>
> Wayne Fay wrote:
> >
> > There is no "shortcut" per se. You need to find each such situation
> > and explicitly exclude the old/invalid artifact and explicitly add the
> > proper/new artifact to your dependency list.
> >
> > Alternatively since it sounds like you are already changing poms in
> > your repo (not generally a good idea imo), you could just change the
> > dependency directly in the associated project pom files. Then when you
> > simply refer to acegi, it will pull in the newer ehcache directly.
> >
> > Wayne
> >
> > On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
> >>
> >> Oh,
> >> Sorry, I made a mistake,
> >> acegi-security-parent declaration is the following
> >> <dependency>
> >>    <groupId>ehcache</groupId>
> >>    <artifactId>ehcache</artifactId>
> >>    <version>1.1</version>
> >>    <optional>true</optional>
> >> </dependency>
> >>
> >>
> >> a cup of Java, cheers!
> >> Sha Jiang
> >>
> >>
> >> jiangshachina wrote:
> >> >
> >> > Hi Wendy,
> >> > You are right.
> >> > My declaration,
> >> > <dependency>
> >> >       <groupId>net.sf.ehcache</groupId>
> >> >       <artifactId>ehcache</artifactId>
> >> >       <version>1.2.3</version>
> >> > </dependency>
> >> >
> >> > But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets the
> >> > following,
> >> > <dependency>
> >> >     <groupId>net.sf.ehcache</groupId>
> >> >     <artifactId>ehcache</artifactId>
> >> >     <version>1.1</version>
> >> >     <optional>true</optional>
> >> > </dependency>
> >> > May there are many similar cases, how can I cancel the trouble?
> >> >
> >> > Thanks in advance!
> >> >
> >> > a cup of Java, cheers!
> >> > Sha Jiang
> >> >
> >> >
> >> > Wendy Smoak-3 wrote:
> >> >>
> >> >> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
> >> >>> I have a Web project.
> >> >>> I declare ehcache-1.2.3.jar as dependency.
> >> >>> But ehcache-1.1.jar is transitive dependency of one of my directly
> >> >>> dependency(acegi-security-1.0.2.jar).
> >> >>> Then I run "mvn clean package", the two jar files are all in
> >> >>> WEB-INF/lib.
> >> >>> How to resolve the problem?
> >> >>
> >> >> When you say you declare a dependency, we need to see the whole thing:
> >> >>  groupId, artifactId, and version.
> >> >>
> >> >> My guess is that your EHCache jars are coming from two different
> >> >> groupIds, so Maven can't figure out that they are the same.
> >> >>
> >> >> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
> >> >> http://repo1.maven.org/maven2/ehcache/ehcache/
> >> >>
> >> >> The output of "mvn clean install -X" should help you figure out where
> >> >> each one is coming from.
> >> >>
> >> >> --
> >> >> Wendy
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> >> For additional commands, e-mail: users-help@maven.apache.org
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613552
> >> 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
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7614503
> 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
>
>

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


Re: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Hi Wayne,
This time, I used
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.1</version>
    <configuration>
        <warSourceExcludes>WEB-INF/lib/some.jar</warSourceExcludes>
    </configuration>
</plugin>
to excludes the jar files by hard way.

> Alternatively since it sounds like you are already changing poms in
> your repo (not generally a good idea imo)
I agree with you, so finally, I don't use the approach.

a cup of Java, cheers!
Sha Jiang


Wayne Fay wrote:
> 
> There is no "shortcut" per se. You need to find each such situation
> and explicitly exclude the old/invalid artifact and explicitly add the
> proper/new artifact to your dependency list.
> 
> Alternatively since it sounds like you are already changing poms in
> your repo (not generally a good idea imo), you could just change the
> dependency directly in the associated project pom files. Then when you
> simply refer to acegi, it will pull in the newer ehcache directly.
> 
> Wayne
> 
> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>>
>> Oh,
>> Sorry, I made a mistake,
>> acegi-security-parent declaration is the following
>> <dependency>
>>    <groupId>ehcache</groupId>
>>    <artifactId>ehcache</artifactId>
>>    <version>1.1</version>
>>    <optional>true</optional>
>> </dependency>
>>
>>
>> a cup of Java, cheers!
>> Sha Jiang
>>
>>
>> jiangshachina wrote:
>> >
>> > Hi Wendy,
>> > You are right.
>> > My declaration,
>> > <dependency>
>> >       <groupId>net.sf.ehcache</groupId>
>> >       <artifactId>ehcache</artifactId>
>> >       <version>1.2.3</version>
>> > </dependency>
>> >
>> > But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets the
>> > following,
>> > <dependency>
>> >     <groupId>net.sf.ehcache</groupId>
>> >     <artifactId>ehcache</artifactId>
>> >     <version>1.1</version>
>> >     <optional>true</optional>
>> > </dependency>
>> > May there are many similar cases, how can I cancel the trouble?
>> >
>> > Thanks in advance!
>> >
>> > a cup of Java, cheers!
>> > Sha Jiang
>> >
>> >
>> > Wendy Smoak-3 wrote:
>> >>
>> >> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>> >>> I have a Web project.
>> >>> I declare ehcache-1.2.3.jar as dependency.
>> >>> But ehcache-1.1.jar is transitive dependency of one of my directly
>> >>> dependency(acegi-security-1.0.2.jar).
>> >>> Then I run "mvn clean package", the two jar files are all in
>> >>> WEB-INF/lib.
>> >>> How to resolve the problem?
>> >>
>> >> When you say you declare a dependency, we need to see the whole thing:
>> >>  groupId, artifactId, and version.
>> >>
>> >> My guess is that your EHCache jars are coming from two different
>> >> groupIds, so Maven can't figure out that they are the same.
>> >>
>> >> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
>> >> http://repo1.maven.org/maven2/ehcache/ehcache/
>> >>
>> >> The output of "mvn clean install -X" should help you figure out where
>> >> each one is coming from.
>> >>
>> >> --
>> >> Wendy
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613552
>> 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
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7614503
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: adds same artifacts(different version)?

Posted by Wayne Fay <wa...@gmail.com>.
There is no "shortcut" per se. You need to find each such situation
and explicitly exclude the old/invalid artifact and explicitly add the
proper/new artifact to your dependency list.

Alternatively since it sounds like you are already changing poms in
your repo (not generally a good idea imo), you could just change the
dependency directly in the associated project pom files. Then when you
simply refer to acegi, it will pull in the newer ehcache directly.

Wayne

On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>
> Oh,
> Sorry, I made a mistake,
> acegi-security-parent declaration is the following
> <dependency>
>    <groupId>ehcache</groupId>
>    <artifactId>ehcache</artifactId>
>    <version>1.1</version>
>    <optional>true</optional>
> </dependency>
>
>
> a cup of Java, cheers!
> Sha Jiang
>
>
> jiangshachina wrote:
> >
> > Hi Wendy,
> > You are right.
> > My declaration,
> > <dependency>
> >       <groupId>net.sf.ehcache</groupId>
> >       <artifactId>ehcache</artifactId>
> >       <version>1.2.3</version>
> > </dependency>
> >
> > But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets the
> > following,
> > <dependency>
> >     <groupId>net.sf.ehcache</groupId>
> >     <artifactId>ehcache</artifactId>
> >     <version>1.1</version>
> >     <optional>true</optional>
> > </dependency>
> > May there are many similar cases, how can I cancel the trouble?
> >
> > Thanks in advance!
> >
> > a cup of Java, cheers!
> > Sha Jiang
> >
> >
> > Wendy Smoak-3 wrote:
> >>
> >> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
> >>> I have a Web project.
> >>> I declare ehcache-1.2.3.jar as dependency.
> >>> But ehcache-1.1.jar is transitive dependency of one of my directly
> >>> dependency(acegi-security-1.0.2.jar).
> >>> Then I run "mvn clean package", the two jar files are all in
> >>> WEB-INF/lib.
> >>> How to resolve the problem?
> >>
> >> When you say you declare a dependency, we need to see the whole thing:
> >>  groupId, artifactId, and version.
> >>
> >> My guess is that your EHCache jars are coming from two different
> >> groupIds, so Maven can't figure out that they are the same.
> >>
> >> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
> >> http://repo1.maven.org/maven2/ehcache/ehcache/
> >>
> >> The output of "mvn clean install -X" should help you figure out where
> >> each one is coming from.
> >>
> >> --
> >> Wendy
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613552
> 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
>
>

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


Re: adds same artifacts(different version)?

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/29/06, jiangshachina <ji...@gmail.com> wrote:

> The more I use Maven,
> the more I think Maven central repository(artifacts) blocks the work of
> adding transitive dependencies Automatically.
> Dependency and transitive dependency may don't have good hierarchy.
> On the aspect, can any body give me some experience?

Maven's transitive dependency mechanism is only as good as the
repository metadata we give it.  When you find situations like this,
report them under 'Maven Evangelism' in JIRA and/or to the project
itself.

In this case, it sounds like the artifacts in the 'ehcache' groupId
need to be "relocated" to net.sf.ehcache groupId so that Maven will
know they are the same.

-- 
Wendy

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


Re: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Hello,
The more I use Maven,
the more I think Maven central repository(artifacts) blocks the work of
adding transitive dependencies Automatically.
Dependency and transitive dependency may don't have good hierarchy.
On the aspect, can any body give me some experience?
Thanks in advance! 

a cup of Java, cheers!
Sha Jiang


jiangshachina wrote:
> 
> Oh,
> Sorry, I made a mistake,
> acegi-security-parent declaration is the following
> <dependency>
>     <groupId>ehcache</groupId>
>     <artifactId>ehcache</artifactId>
>     <version>1.1</version>
>     <optional>true</optional>
> </dependency>
> 
> 
> a cup of Java, cheers!
> Sha Jiang
> 
> 
> jiangshachina wrote:
>> 
>> Hi Wendy,
>> You are right.
>> My declaration,
>> <dependency>
>> 	<groupId>net.sf.ehcache</groupId>
>> 	<artifactId>ehcache</artifactId>
>> 	<version>1.2.3</version>
>> </dependency>
>> 
>> But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets the
>> following,
>> <dependency>
>>     <groupId>net.sf.ehcache</groupId>
>>     <artifactId>ehcache</artifactId>
>>     <version>1.1</version>
>>     <optional>true</optional>
>> </dependency>
>> May there are many similar cases, how can I cancel the trouble?
>> 
>> Thanks in advance!
>> 
>> a cup of Java, cheers!
>> Sha Jiang
>> 
>> 
>> Wendy Smoak-3 wrote:
>>> 
>>> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>>>> I have a Web project.
>>>> I declare ehcache-1.2.3.jar as dependency.
>>>> But ehcache-1.1.jar is transitive dependency of one of my directly
>>>> dependency(acegi-security-1.0.2.jar).
>>>> Then I run "mvn clean package", the two jar files are all in
>>>> WEB-INF/lib.
>>>> How to resolve the problem?
>>> 
>>> When you say you declare a dependency, we need to see the whole thing:
>>>  groupId, artifactId, and version.
>>> 
>>> My guess is that your EHCache jars are coming from two different
>>> groupIds, so Maven can't figure out that they are the same.
>>> 
>>> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
>>> http://repo1.maven.org/maven2/ehcache/ehcache/
>>> 
>>> The output of "mvn clean install -X" should help you figure out where
>>> each one is coming from.
>>> 
>>> -- 
>>> Wendy
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7614442
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: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Oh,
Sorry, I made a mistake,
acegi-security-parent declaration is the following
<dependency>
    <groupId>ehcache</groupId>
    <artifactId>ehcache</artifactId>
    <version>1.1</version>
    <optional>true</optional>
</dependency>


a cup of Java, cheers!
Sha Jiang


jiangshachina wrote:
> 
> Hi Wendy,
> You are right.
> My declaration,
> <dependency>
> 	<groupId>net.sf.ehcache</groupId>
> 	<artifactId>ehcache</artifactId>
> 	<version>1.2.3</version>
> </dependency>
> 
> But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets the
> following,
> <dependency>
>     <groupId>net.sf.ehcache</groupId>
>     <artifactId>ehcache</artifactId>
>     <version>1.1</version>
>     <optional>true</optional>
> </dependency>
> May there are many similar cases, how can I cancel the trouble?
> 
> Thanks in advance!
> 
> a cup of Java, cheers!
> Sha Jiang
> 
> 
> Wendy Smoak-3 wrote:
>> 
>> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>>> I have a Web project.
>>> I declare ehcache-1.2.3.jar as dependency.
>>> But ehcache-1.1.jar is transitive dependency of one of my directly
>>> dependency(acegi-security-1.0.2.jar).
>>> Then I run "mvn clean package", the two jar files are all in
>>> WEB-INF/lib.
>>> How to resolve the problem?
>> 
>> When you say you declare a dependency, we need to see the whole thing:
>>  groupId, artifactId, and version.
>> 
>> My guess is that your EHCache jars are coming from two different
>> groupIds, so Maven can't figure out that they are the same.
>> 
>> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
>> http://repo1.maven.org/maven2/ehcache/ehcache/
>> 
>> The output of "mvn clean install -X" should help you figure out where
>> each one is coming from.
>> 
>> -- 
>> Wendy
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613552
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: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Hi Wendy,
You are right.
My declaration,
<dependency>
	<groupId>net.sf.ehcache</groupId>
	<artifactId>ehcache</artifactId>
	<version>1.2.3</version>
</dependency>

But acegi-security-parent(I'm using acegi-security-1.0.2.jar) sets the
following,
<dependency>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache</artifactId>
    <version>1.1</version>
    <optional>true</optional>
</dependency>
May there are many similar cases, how can I cancel the trouble?

Thanks in advance!

a cup of Java, cheers!
Sha Jiang


Wendy Smoak-3 wrote:
> 
> On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
>> I have a Web project.
>> I declare ehcache-1.2.3.jar as dependency.
>> But ehcache-1.1.jar is transitive dependency of one of my directly
>> dependency(acegi-security-1.0.2.jar).
>> Then I run "mvn clean package", the two jar files are all in WEB-INF/lib.
>> How to resolve the problem?
> 
> When you say you declare a dependency, we need to see the whole thing:
>  groupId, artifactId, and version.
> 
> My guess is that your EHCache jars are coming from two different
> groupIds, so Maven can't figure out that they are the same.
> 
> http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
> http://repo1.maven.org/maven2/ehcache/ehcache/
> 
> The output of "mvn clean install -X" should help you figure out where
> each one is coming from.
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7613512
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: adds same artifacts(different version)?

Posted by Wendy Smoak <ws...@gmail.com>.
On 11/29/06, jiangshachina <ji...@gmail.com> wrote:
> I have a Web project.
> I declare ehcache-1.2.3.jar as dependency.
> But ehcache-1.1.jar is transitive dependency of one of my directly
> dependency(acegi-security-1.0.2.jar).
> Then I run "mvn clean package", the two jar files are all in WEB-INF/lib.
> How to resolve the problem?

When you say you declare a dependency, we need to see the whole thing:
 groupId, artifactId, and version.

My guess is that your EHCache jars are coming from two different
groupIds, so Maven can't figure out that they are the same.

http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/
http://repo1.maven.org/maven2/ehcache/ehcache/

The output of "mvn clean install -X" should help you figure out where
each one is coming from.

-- 
Wendy

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


Re: adds same artifacts(different version)?

Posted by jiangshachina <ji...@gmail.com>.
Hi franz,
Thanks in advance.
Your instructions have general purpose.
I'll check it.

a cup of Java, cheers!
Sha Jiang


franz see wrote:
> 
> Good day to you, Sha Jiang,
> 
> Maven2 handles dependencies by searching for versionless artifact keys
> from the dependency tree and chooses the version which is closest to the
> root ( the pom you ran your mvn command on ). Therefore, you cannot depend
> on two different versions of an artifact. If you see a name-x.jar and a
> name-y.jar, then that would most likely mean that they are of different
> groupIds ( either that or you failed to clean, or it was placed there by
> some other plugin like maven-dependency-plugin, maven-assembly-plugin,
> maven-antrun-plugin, etc).
> 
> Btw, the artifcat key is the name of the artifact in the following format
> - <groupId>:<artifactId>:<version>. Thus, a versionless artifact key is of
> the format, <groupId>:<artifactId>.
> 
> To trace your dependency tree, you can use mvn
> project-info-reports:dependencies. This will then generate a dependency
> tree report in your traget\site\dependencies.html. Furthermore, if you
> doubt the information given by that report, you can add the -X option in
> your maven command so that you can trace through the debug logs. 
> 
> Cheers,
> Franz
> 
> 
> jiangshachina wrote:
>> 
>> Hi,
>> I have a Web project.
>> I declare ehcache-1.2.3.jar as dependency.
>> But ehcache-1.1.jar is transitive dependency of one of my directly
>> dependency(acegi-security-1.0.2.jar).
>> Then I run "mvn clean package", the two jar files are all in WEB-INF/lib.
>> How to resolve the problem?
>> 
>> More strangely, I changed the POM of artifact acegi-security-1.0.2.jar,
>> and made it to use ehcache-1.2.3.jar,
>> But ehcache-1.1.jar still was in WEB-INF/lib.
>> May ehcache-1.1.jar is other (direct or indirect) dependencies'
>> transitive denpendency,
>> but I can't find all.
>> How to resolve the problem?
>> 
>> Thanks in advance.
>> 
>> a cup of Java, cheers!
>> Sha Jiang
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7652134
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: adds same artifacts(different version)?

Posted by franz see <fr...@gmail.com>.
Good day to you, Sha Jiang,

Maven2 handles dependencies by searching for versionless artifact keys from
the dependency tree and chooses the version which is closest to the root (
the pom you ran your mvn command on ). Therefore, you cannot depend on two
different versions of an artifact. If you see a name-x.jar and a name-y.jar,
then that would most likely mean that they are of different groupIds (
either that or you failed to clean, or it was placed there by some other
plugin like maven-dependency-plugin, maven-assembly-plugin,
maven-antrun-plugin, etc).

Btw, the artifcat key is the name of the artifact in the following format -
<groupId>:<artifactId>:<version>. Thus, a versionless artifact key is of the
format, <groupId>:<artifactId>.

To trace your dependency tree, you can use mvn
project-info-reports:dependencies. This will then generate a dependency tree
report in your traget\site\dependencies.html. Furthermore, if you doubt the
information given by that report, you can add the -X option in your maven
command so that you can trace through the debug logs. 

Cheers,
Franz


jiangshachina wrote:
> 
> Hi,
> I have a Web project.
> I declare ehcache-1.2.3.jar as dependency.
> But ehcache-1.1.jar is transitive dependency of one of my directly
> dependency(acegi-security-1.0.2.jar).
> Then I run "mvn clean package", the two jar files are all in WEB-INF/lib.
> How to resolve the problem?
> 
> More strangely, I changed the POM of artifact acegi-security-1.0.2.jar,
> and made it to use ehcache-1.2.3.jar,
> But ehcache-1.1.jar still was in WEB-INF/lib.
> May ehcache-1.1.jar is other (direct or indirect) dependencies' transitive
> denpendency,
> but I can't find all.
> How to resolve the problem?
> 
> Thanks in advance.
> 
> a cup of Java, cheers!
> Sha Jiang
> 

-- 
View this message in context: http://www.nabble.com/adds-same-artifacts%28different-version%29--tf2729513s177.html#a7650831
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