Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lyo-dev] Use of Maven dependencyManagement elements

While updating eclipse/Lyo eclipse project dependencies, I came across a use of the Maven <dependencyManagement> element that I don't quite understand.

Some of the OSLC4J projects, such as org.eclipse.lyo.client/org.eclipse.lyo.client.java, contain <dependencyManagement> elements in their pom.xml files. These don't hurt anything, but don't make sense for projects that don't have child module projects because there are no modules that will inherit the versions.

My understanding of Maven dependency management is that aggregrator projects can be used to to organize child projects or modules, and can define properties and dependencies that specify the preferred versions that child modules should use. This allows common property and dependency versions to be listed in one place. Child modules still have to declare all the dependencies they use (versions are inherited, not the managed dependencies), but they don't have to redundantly specify the versions.

OSLC4J does have an aggregator project, org.eclipse.lyo.oslc4j.build whose pom.xml file declares the modules that makeup OSLC4J.
        <modules>
                <module>../org.eclipse.lyo.oslc4j.core</module>
                <module>../org.eclipse.lyo.oslc4j.provider.jena</module>
                <module>../org.eclipse.lyo.oslc4j.provider.json4j</module>
                <module>../org.eclipse.lyo.oslc4j.wink</module>
                <module>../org.eclipse.lyo.oslc4j.registry</module>
                <module>../org.eclipse.lyo.core.query</module>
                <module>../org.eclipse.lyo.core.trs</module>
                <module>../org.eclipse.lyo.core.utils</module>
        </modules>

However, this aggregator project does not define any common OSLC4J dependencyManagement dependencies, nor do any of the module project declare org.eclipse.lyo.oslc4j.build to be their parent project. As a result, all of the OSLC4J projects redundantly and in some cases inconsistently declare their own dependency versions.

Question: Why doesn't this aggregrator project include org.eclipse.lyo.client/org.eclipse.lyo.client.java? Is that just missing? It is delivered as part of the OSLC4J SDK.

I addition, module projects such as org.eclipse.lyo.client/org.eclipse.lyo.client.java, contain dependencyManagement elements, while these are leaf modules, they are not the parent module of any other module, so there are no modules to inherit the dependencyManagement dependency versions.

Does anyone have any insight on why OSLC4J uses of Maven dependencyManagement elements this way?

Possible actions as part of the 2.2.0 dependency update release:

1. Remove all dependencyManagement elements from the OSLC4J projects, and merge the dependencies into the existing <dependencies> element.

2. Use mvn dependency:analyze to clean up the unused or missing dependency references in the pom.xml files

3. Define all the common OSLC4J dependencies and versions in a dependencyManagement element in  org.eclipse.lyo.oslc4j.build

4. Add <parent> elements in each of the OSLC4J module projects to refer to org.eclipse.lyo.oslc4j.build

5. Remove all dependency versions from the OSLC4J module projects, and inherit the versions from the org.eclipse.lyo.oslc4j.build parent

6. Also add a lyo.verson property to org.eclipse.lyo.oslc4j.build and use this property value to specify the version of each module. This way the version of OSLC4J can be specified in one place.



Jim Amsden, Senior Technical Staff Member
OSLC and Linked Lifecycle Data
919-525-6575


Back to the top