Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dash-dev] Version ranges or exact versions



On 11-03-20 09:34 AM, Alex Blewitt wrote:
On 20 Mar 2011, at 13:16, Igor Fedorenko wrote:

You can use dependency with scope=import to reuse predefined
<dependencyManagement/>  section in multiple projects. This blog [1] is
supposed to explain how to do this, but formatting seems to be off :-(

The<  and>  aren't escaped, so the tags are being filtered out. You need to replace them with&lt; and&gt;. All a<pre>  block does is to make whitespace significant (xml:space="preserve" in HTML5) rather than as is.

Beware that unlike OSGi and P2, Maven does not attempt to optimise
dependency versions. If the same dependency is present multiple times in
project's dependency graph, Maven will use the first version it finds
while traversing the graph.<dependencyManagement/>  is the mechanism a
project can use to force desired dependency version.

So we could have (say):

<dependency>
   <artifactId>org.eclipse.release.helios</artifactId>
   <groupId>org.eclipse.release</groupId>
   <version>3.6.0</version>
   <type>pom</type>
</dependency>

I believe <scope>import</scope> is required in the above <dependency/>
element.


and then all the dependencies could depend on that to consume a common dependencyManagement set:

<project>
   <artifactId>org.eclipse.release.helios</artifactId>
   <groupId>org.eclipse.release</groupId>
   <version>3.6.0</version>
   <packaging>pom</packaging>
   <dependencyManagement>
     <dependency>
       <artifacIdt>org.eclipse.jdt.core</artifactId>
       <groupId>org.eclipse.jdt</groupId>
       <version>3.6.0</version>
     </dependency>
   </dependencyManagement>
</project>

Would you then in the POM encode the dependency version as a range, and let the import of the release constrain what element in the range is used?



I don't think it really matters, as <dependencyManagement/> overrides
all dependency versions. I think it is even possible to omit <version/>
element altogether, which will force all consumers to specify
<dependencyManagement/> via scope=import or explicitly.

--
Regards,
Igor



Back to the top