| === Transitive Dependencies |
| |
| :doctype: article |
| :revnumber: {project-version} |
| |
| As every dependencies build its own dependency tree two dependencies can depend on the same artifact. |
| But they do not necessarily depend on the same version. |
| This can result to a classpath with two version of the same dependency. |
| |
| ==== Solution |
| |
| To work around this problem we define every transitive dependency in the dependency management exactly once with a defined version. |
| To search for all dependencies this script can be used: |
| |
| mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:resolve | grep '\[INFO\] ' | cut -d':' -f1-4 | sort | uniq | cut -c11- | grep -v none | grep -v org.eclipse | sed -r 's/(.*):(.*):(.*):(.*)/ \<dependency\>\n \<groupId\>\1\<\/groupId\>\n \<artifactId>\2\<\/artifactId\>\n \<version\>\4\<\/version\>\n \<\/dependency\>/' |
| |
| It prints out the dependencies as maven dependencies. |
| Before this script is used the transitive section in the org.eclipse.scout.rt/pom.xml at the end of the dependencyManagement section should be commented or removed. |
| So we get all dependencies in their intended version. |
| |
| The output can be compared to the effective POM of org.eclipse.scout.rt/pom.xml (with commented out transitive dependencies). |
| Duplicates can be removed and the remaining purely transitive dependencies can be added to the transitive section. |
| |
| Note: c3p0 is an optional transitive dependency from quartz not used in Scout and can be omitted. |