Repository: Wikidata/Wikidata-Toolkit (java)

Issue:
Migrate to <dependencyManagement> to control versions of dependencies
We currently use Maven properties in the root POM to specify the versions of our dependencies, but that only works to control the versions of the dependencies that are directly mentioned in submodules. Using the <dependencyManagement> section would instead let us control the versioning of transitive dependencies as well.

Is that correct @robertvazan?

Pull request:
Switch to using <dependencyManagement> for Maven dependencies
Closes #706.

Patch:
diff --git a/pom.xml b/pom.xml
index 8eb46788..7eba24c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,49 +72,139 @@
 
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<apacheCommonsCompressVersion>1.26.1</apacheCommonsCompressVersion>
-		<apacheCommonsLangVersion>3.14.0</apacheCommonsLangVersion>
-		<apacheCommonsIOVersion>2.16.0</apacheCommonsIOVersion>
 		<jacksonVersion>2.17.0</jacksonVersion>
-		<junitVersion>4.13.2</junitVersion>
-		<hamcrestVersion>2.2</hamcrestVersion>
-		<mockitoVersion>5.11.0</mockitoVersion>
-		<rdf4jVersion>4.3.11</rdf4jVersion>
-		<slf4jVersion>2.0.12</slf4jVersion>
-		<threetenVersion>1.7.2</threetenVersion>
-		<okhttpSignpostVersion>1.1.0</okhttpSignpostVersion>
 		<okhttpVersion>4.12.0</okhttpVersion>
 	</properties>
 
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>junit</groupId>
+				<artifactId>junit</artifactId>
+				<version>4.13.2</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.hamcrest</groupId>
+				<artifactId>hamcrest-core</artifactId>
+				<version>2.2</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.mockito</groupId>
+				<artifactId>mockito-core</artifactId>
+				<version>5.11.0</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.slf4j</groupId>
+				<artifactId>slf4j-api</artifactId>
+				<version>2.0.12</version>
+			</dependency>
+			<dependency>
+				<groupId>org.slf4j</groupId>
+				<artifactId>slf4j-log4j12</artifactId>
+				<version>2.0.12</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.commons</groupId>
+				<artifactId>commons-lang3</artifactId>
+				<version>3.14.0</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.commons</groupId>
+				<artifactId>commons-compress</artifactId>
+				<version>1.26.1</version>
+			</dependency>
+			<dependency>
+				<groupId>com.fasterxml.jackson.core</groupId>
+				<artifactId>jackson-annotations</artifactId>
+				<version>${jacksonVersion}</version>
+			</dependency>
+			<dependency>
+				<groupId>com.fasterxml.jackson.core</groupId>
+				<artifactId>jackson-core</artifactId>
+				<version>${jacksonVersion}</version>
+			</dependency>
+			<dependency>
+				<groupId>com.fasterxml.jackson.core</groupId>
+				<artifactId>jackson-databind</artifactId>
+				<version>${jacksonVersion}</version>
+			</dependency>
+			<dependency>
+				<groupId>com.fasterxml.jackson.datatype</groupId>
+				<artifactId>jackson-datatype-jdk8</artifactId>
+				<version>${jacksonVersion}</version>
+			</dependency>
+			<dependency>
+				<groupId>org.threeten</groupId>
+				<artifactId>threeten-extra</artifactId>
+				<version>1.7.2</version>
+			</dependency>
+			<dependency>
+				<groupId>commons-io</groupId>
+				<artifactId>commons-io</artifactId>
+				<version>2.16.0</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>com.squareup.okhttp3</groupId>
+				<artifactId>okhttp</artifactId>
+				<version>${okhttpVersion}</version>
+			</dependency>
+			<dependency>
+				<groupId>com.squareup.okhttp3</groupId>
+				<artifactId>okhttp-urlconnection</artifactId>
+				<version>${okhttpVersion}</version>
+			</dependency>
+			<dependency>
+				<groupId>com.squareup.okhttp3</groupId>
+				<artifactId>mockwebserver</artifactId>
+				<version>${okhttpVersion}</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>se.akerfeldt</groupId>
+				<artifactId>okhttp-signpost</artifactId>
+				<version>1.1.0</version>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse.rdf4j</groupId>
+				<artifactId>rdf4j-rio-turtle</artifactId>
+				<version>4.3.11</version>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse.rdf4j</groupId>
+				<artifactId>rdf4j-rio-ntriples</artifactId>
+				<version>4.3.11</version>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+
 	<dependencies>
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>${junitVersion}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.hamcrest</groupId>
 			<artifactId>hamcrest-core</artifactId>
-			<version>${hamcrestVersion}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.mockito</groupId>
 			<artifactId>mockito-core</artifactId>
-			<version>${mockitoVersion}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-api</artifactId>
-			<version>${slf4jVersion}</version>
 		</dependency>
 		<dependency>
 			<!-- Useful helpers for cleaner coding -->
 			<groupId>org.apache.commons</groupId>
 			<artifactId>commons-lang3</artifactId>
-			<version>${apacheCommonsLangVersion}</version>
 		</dependency>
 	</dependencies>
 
@@ -207,7 +297,7 @@
 				<!-- Call mvn test jacoco:report to generate test coverage -->
 				<groupId>org.jacoco</groupId>
 				<artifactId>jacoco-maven-plugin</artifactId>
-				<version>0.8.11</version>
+				<version>0.8.12</version>
 				<executions>
 					<execution>
 						<id>prepare-agent</id>
@@ -221,7 +311,7 @@
 				<!-- Pluging to generate release source -->
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-source-plugin</artifactId>
-				<version>3.3.0</version>
+				<version>3.3.1</version>
 				<executions>
 					<execution>
 						<id>attach-sources</id>
diff --git a/wdtk-datamodel/pom.xml b/wdtk-datamodel/pom.xml
index 3c3c9849..11f8d90f 100644
--- a/wdtk-datamodel/pom.xml
+++ b/wdtk-datamodel/pom.xml
@@ -30,32 +30,26 @@
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-annotations</artifactId>
-			<version>${jacksonVersion}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-core</artifactId>
-			<version>${jacksonVersion}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-databind</artifactId>
-			<version>${jacksonVersion}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.fasterxml.jackson.datatype</groupId>
 			<artifactId>jackson-datatype-jdk8</artifactId>
-			<version>${jacksonVersion}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.threeten</groupId>
 			<artifactId>threeten-extra</artifactId>
-			<version>${threetenVersion}</version>
 		</dependency>
 		<dependency>
 			<groupId>commons-io</groupId>
 			<artifactId>commons-io</artifactId>
-			<version>${apacheCommonsIOVersion}</version>
 			<scope>test</scope>
 		</dependency>
 	</dependencies>
diff --git a/wdtk-examples/pom.xml b/wdtk-examples/pom.xml
index 7bf1a882..58fd1cfc 100644
--- a/wdtk-examples/pom.xml
+++ b/wdtk-examples/pom.xml
@@ -48,12 +48,10 @@
 		<dependency> 
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-log4j12</artifactId>
-			<version>${slf4jVersion}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.commons</groupId>
 			<artifactId>commons-compress</artifactId>
-			<version>${apacheCommonsCompressVersion}</version>
 		</dependency>
 	</dependencies>
 
diff --git a/wdtk-rdf/pom.xml b/wdtk-rdf/pom.xml
index fb3d1a8d..77ced2ee 100644
--- a/wdtk-rdf/pom.xml
+++ b/wdtk-rdf/pom.xml
@@ -18,12 +18,10 @@
   	<dependency>
   		<groupId>org.eclipse.rdf4j</groupId>
   		<artifactId>rdf4j-rio-turtle</artifactId>
-		<version>${rdf4jVersion}</version>
 	</dependency>
 	<dependency>
 		<groupId>org.eclipse.rdf4j</groupId>
 		<artifactId>rdf4j-rio-ntriples</artifactId>
-		<version>${rdf4jVersion}</version>
 	</dependency>
 	<dependency>			
 		<groupId>${project.groupId}</groupId>
@@ -44,7 +42,6 @@
 		<groupId>${project.groupId}</groupId>
 		<artifactId>wdtk-testing</artifactId>
 		<version>${project.version}</version>
-		<scope>test</scope>
 	</dependency>
   </dependencies>
   <build>
diff --git a/wdtk-util/pom.xml b/wdtk-util/pom.xml
index 1b2dade7..0cf36fe1 100644
--- a/wdtk-util/pom.xml
+++ b/wdtk-util/pom.xml
@@ -18,7 +18,6 @@
 		<dependency>
 			<groupId>org.apache.commons</groupId>
 			<artifactId>commons-compress</artifactId>
-			<version>${apacheCommonsCompressVersion}</version>
 		</dependency>
 	</dependencies>
 
diff --git a/wdtk-wikibaseapi/pom.xml b/wdtk-wikibaseapi/pom.xml
index 5eaa3458..c1c1a83e 100644
--- a/wdtk-wikibaseapi/pom.xml
+++ b/wdtk-wikibaseapi/pom.xml
@@ -35,24 +35,20 @@
 		<dependency>
 			<groupId>com.squareup.okhttp3</groupId>
 			<artifactId>okhttp</artifactId>
-			<version>${okhttpVersion}</version>
 		</dependency>
                 <dependency>
 			<groupId>com.squareup.okhttp3</groupId>
 			<artifactId>okhttp-urlconnection</artifactId>
-			<version>${okhttpVersion}</version>
 		</dependency>
 
 		<dependency>
 			<groupId>com.squareup.okhttp3</groupId>
 			<artifactId>mockwebserver</artifactId>
-			<version>${okhttpVersion}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>se.akerfeldt</groupId>
 			<artifactId>okhttp-signpost</artifactId>
-			<version>${okhttpSignpostVersion}</version>
 		</dependency>
 
 	</dependencies>


Test patch:
diff --git a/wdtk-testing/pom.xml b/wdtk-testing/pom.xml
index 955f3dba..8d95171d 100644
--- a/wdtk-testing/pom.xml
+++ b/wdtk-testing/pom.xml
@@ -18,12 +18,12 @@
 		<dependency>
 			<groupId>${project.groupId}</groupId>
 			<artifactId>wdtk-util</artifactId>
-			<version>${project.version}</version>
+                        <version>${project.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.mockito</groupId>
 			<artifactId>mockito-core</artifactId>  
-			<version>${mockitoVersion}</version> 
+                        <scope>compile</scope>
 		</dependency>
 	</dependencies>
 </project>