Ohh, I'm sorry.  Ugh.  :-/

Below is the mmm pom that causes the install failure.  This pom simulates
exactly how a project I'm depending on is erroneously defined.  To get
around it, I've implemented the fix as in nnn.xml.  Just providing a
concluding example here for anybody with the same issue in the future.


----- start mmm.xml ----------------------------
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>

  <groupId>testGroup</groupId>
  <artifactId>mmm</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>mmm</name>
  <url>http://maven.apache.org</url>

  <dependencies>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>[1.2.13]</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>
----- end mmm.xml -------------------------------


On Sun, May 16, 2010 at 5:44 PM, Ron Wheeler <[email protected]
> wrote:

>
> Who is asking for 1.2.13 now? I only see 1.2.15 in your poms?
>
> I am not sure why you have the "[]" around the version in mmm's pom.xml
>
>
> Ron
>
>
> On 16/05/2010 5:03 PM, Steve Francolla wrote:
>
>> I just needed to resolve this issue myself with log4j [1.2.13].  Working
>> example is below.  Thank yous go out to the gentlemen pointing me to
>> depMgmt.
>>
>>
>> Case:
>> - Artifact mmm depends on log4j with version "[1.2.13]"
>> - Artifact nnn depends on mmm.
>> - Mvn clean install of nnn fails with "Couldn't find a version in [1.2.15,
>> 1.2.16] to match range [1.2.13,1.2.13]" message.
>> - Added dependencyManagement section to nnn pom.xml to include dependency
>> on
>> mmm with scope value "import" and dependency on log4j with version value
>> "1.2.15" to override the inherited log4j dependency's version and
>> successfully build artifact nnn.
>>
>>
>> Functional pom files:
>>
>> ----- start mmm pom.xml:
>> ----------------------------------------------------
>> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance";
>>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd";>
>>   <modelVersion>4.0.0</modelVersion>
>>
>>   <groupId>testGroup</groupId>
>>   <artifactId>mmm</artifactId>
>>   <packaging>jar</packaging>
>>   <version>1.0-SNAPSHOT</version>
>>   <name>mmm</name>
>>   <url>http://maven.apache.org</url>
>>
>>   <dependencies>
>>     <dependency>
>>       <groupId>log4j</groupId>
>>       <artifactId>log4j</artifactId>
>>       <version>[1.2.15]</version>
>>       <scope>compile</scope>
>>     </dependency>
>>   </dependencies>
>> </project>
>> ----- end mmm pom.xml:
>> ----------------------------------------------------
>>
>> ----- start nnn pom.xml:
>> ----------------------------------------------------
>> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance";
>>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd";>
>>   <modelVersion>4.0.0</modelVersion>
>>
>>   <groupId>testGroup</groupId>
>>   <artifactId>nnn</artifactId>
>>   <packaging>jar</packaging>
>>   <version>1.0-SNAPSHOT</version>
>>   <name>nnn</name>
>>   <url>http://maven.apache.org</url>
>>
>>   <dependencyManagement>
>>     <dependencies>
>>       <dependency>
>>         <groupId>testGroup</groupId>
>>         <artifactId>mmm</artifactId>
>>         <version>1.0-SNAPSHOT</version>
>>         <type>jar</type>
>>         <scope>import</scope>
>>       </dependency>
>>       <dependency>
>>         <groupId>log4j</groupId>
>>         <artifactId>log4j</artifactId>
>>         <version>1.2.15</version>
>>       </dependency>
>>     </dependencies>
>>   </dependencyManagement>
>>
>>   <dependencies>
>>     <dependency>
>>       <groupId>testGroup</groupId>
>>       <artifactId>mmm</artifactId>
>>       <scope>compile</scope>
>>     </dependency>
>>   </dependencies>
>>
>> </project>
>> ----- end nnn pom.xml:
>> ----------------------------------------------------
>>
>>
>> SF
>>
>>
>>
>>
>> On Wed, Apr 28, 2010 at 3:55 AM, Jörg Schaible<[email protected]
>> >wrote:
>>
>>
>>
>>> Hi Grant,
>>>
>>> Grant Birchmeier wrote:
>>>
>>>
>>>
>>>> If anyone can help, I'd appreciate it.  This is driving me up the
>>>> wall.  I tried googling, but I couldn't find what I needed.
>>>>
>>>> When I build, I get this error:
>>>>
>>>> ---
>>>> Couldn't find a version in [1.2.15, 1.2.16] to match range
>>>>
>>>>
>>> [1.2.13,1.2.13]
>>>
>>>
>>>>   log4j:log4j:jar:null
>>>> ---
>>>>
>>>>
>>> [snip]
>>>
>>>
>>>
>>>> So if I have 1.2.13 in my repo, then why is maven only finding 1.2.14
>>>> and 1.2.15?
>>>>
>>>>
>>> Actually you (in your project) or some of your dependencies declare
>>> version
>>> ranges for log4j and one requires log4j to be used exactly in version
>>> 1.2.13
>>> while another say it must have log4j 1.2.15 or 1.2.16. This requirements
>>> can
>>> obviously not be fulfilled. As Anders already recommended, use a depMgmt
>>> section to override the version with the one you like to use, but you
>>> should
>>> probably ask the developers of the artifacts in question why they think
>>> they
>>> need exactly those versions. Find the artifacts with dependency:tree.
>>>
>>> - Jörg
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to