ICU-21142 Moving CLDR jar file to common location

diff --git a/tools/cldr/cldr-to-icu/README.txt b/tools/cldr/cldr-to-icu/README.txt
index ec9ce25..750f41a 100644
--- a/tools/cldr/cldr-to-icu/README.txt
+++ b/tools/cldr/cldr-to-icu/README.txt
@@ -16,7 +16,9 @@
 Important directories
 ---------------------
 
-CLDR_ROOT = The top-level direcetory for the CLDR project, containing CLDR
+ICU_ROOT = The top-level directory for this ICU project installation.
+
+CLDR_ROOT = The top-level directory for the CLDR project, containing CLDR
             code and non-production data. Usually obtained from:
             https://github.com/unicode-org/cldr
 
@@ -28,6 +30,7 @@
 In Posix systems, it's best to set these as exported shell variables, and any
 following instructions assume they have been set accordingly:
 
+$ export ICU_ROOT=/path/to/icu
 $ export CLDR_ROOT=/path/to/cldr
 $ export CLDR_DIR=/path/to/cldr-staging/production
 
@@ -47,14 +50,13 @@
 
 $ sudo apt-get install maven ant
 
-You also need to install two additional CLDR JAR files in a local Maven
-repository, which can be achieved by either running:
+You must also install an additional CLDR JAR file the local Maven repository at
+$ICU_ROOT/tools/cldr/lib (see the README.txt in that directory for more
+information).
 
+$ cd "$ICU_ROOT/tools/cldr/lib"
 $ install-cldr-jars.sh "$CLDR_ROOT"
 
-from this directory, or following the instructions in lib/README.txt. This
-step must be repeated if you update the code in the CLDR project you are
-using, or are using multiple versions of the CLDR code during development.
 
 Generating all ICU data
 -----------------------
diff --git a/tools/cldr/cldr-to-icu/build-icu-data.xml b/tools/cldr/cldr-to-icu/build-icu-data.xml
index 518fa12..5917adf 100644
--- a/tools/cldr/cldr-to-icu/build-icu-data.xml
+++ b/tools/cldr/cldr-to-icu/build-icu-data.xml
@@ -2,6 +2,9 @@
      License & terms of use: http://www.unicode.org/copyright.html -->
 
 <!--================================================================================
+    Setup:
+    Follow the installation instructions in README.txt in this directory.
+
     To build ICU data files:
     1: Determine the CLDR base directory and set the CLDR_DIR environment variable.
     2: Determine the flags required (see the list of properties below).
diff --git a/tools/cldr/cldr-to-icu/lib/README.txt b/tools/cldr/cldr-to-icu/lib/README.txt
deleted file mode 100644
index c41c27b..0000000
--- a/tools/cldr/cldr-to-icu/lib/README.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-*********************************************************************
-*** © 2019 and later: Unicode, Inc. and others.                   ***
-*** License & terms of use: http://www.unicode.org/copyright.html ***
-*********************************************************************
-
-What is this directory and why is it empty?
--------------------------------------------
-
-This is the root of a local Maven repository which needs to be populated before the
-code in this project can be executed.
-
-To do this, you need to have a local copy of the CLDR project configured on your
-computer and be able able to build the API jar file and copy an existing utility
-jar file. In the examples below it is assumed that <CLDR_ROOT> references this CLDR
-release.
-
-
-Regenerating the CLDR API jar
------------------------------
-
-To regenerate the CLDR API jar you need to build the "jar" target using the Ant
-build.xml file in the "tools/java" directory of the CLDR project:
-
-$ cd <CLDR_ROOT>/tools/java
-$ ant clean jar
-
-This should result in the cldr.jar file being built into that directory, which can then
-be installed as a Maven dependency as described above.
-
-
-Updating local Maven repository
--------------------------------
-
-To update the local Maven repository (e.g. to install the CLDR jar) then from this
-directory (lib/) you should run:
-
-$ mvn install:install-file \
-  -DgroupId=org.unicode.cldr \
-  -DartifactId=cldr-api \
-  -Dversion=0.1-SNAPSHOT \
-  -Dpackaging=jar \
-  -DgeneratePom=true \
-  -DlocalRepositoryPath=. \
-  -Dfile=<CLDR_ROOT>/tools/java/cldr.jar
-
-And also (for the utility jar):
-
-$ mvn install:install-file \
-  -DgroupId=com.ibm.icu \
-  -DartifactId=icu-utilities \
-  -Dversion=0.1-SNAPSHOT \
-  -Dpackaging=jar \
-  -DgeneratePom=true \
-  -DlocalRepositoryPath=. \
-  -Dfile=<CLDR_ROOT>/tools/java/libs/utilities.jar
-
-And if you have updated one of these libraries then from the main project directory
-(i.e. the parent of this directory) run:
-
-$ mvn dependency:purge-local-repository -DsnapshotsOnly=true
-
-After doing this, you should see something like the following list of files in this
-directory:
-
-README.txt   <-- this file
-org/unicode/cldr/cldr-api/maven-metadata-local.xml
-org/unicode/cldr/cldr-api/0.1-SNAPSHOT/maven-metadata-local.xml
-org/unicode/cldr/cldr-api/0.1-SNAPSHOT/cldr-api-0.1-SNAPSHOT.pom
-org/unicode/cldr/cldr-api/0.1-SNAPSHOT/cldr-api-0.1-SNAPSHOT.jar
-com/ibm/icu/icu-utilities/maven-metadata-local.xml
-com/ibm/icu/icu-utilities/0.1-SNAPSHOT/maven-metadata-local.xml
-com/ibm/icu/icu-utilities/0.1-SNAPSHOT/icu-utilities-0.1-SNAPSHOT.jar
-com/ibm/icu/icu-utilities/0.1-SNAPSHOT/icu-utilities-0.1-SNAPSHOT.pom
-
-Finally, if you choose to update the version number of the snapshot, then remember to
-update the root pom.xml, but this is unlikely to be necessary.
diff --git a/tools/cldr/cldr-to-icu/pom.xml b/tools/cldr/cldr-to-icu/pom.xml
index 40e3083..8bd233f 100644
--- a/tools/cldr/cldr-to-icu/pom.xml
+++ b/tools/cldr/cldr-to-icu/pom.xml
@@ -8,11 +8,19 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
+    <!-- Include the parent POM file to add the CLDR API dependency. -->
+    <parent>
+        <groupId>org.unicode.icu</groupId>
+        <artifactId>cldr-lib</artifactId>
+        <version>1.0</version>
+        <relativePath>../lib</relativePath>
+    </parent>
+
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>
 
-    <groupId>org.unicode.icu</groupId>
+    <!-- No need for <groupId> here (it's defined by the parent POM). -->
     <artifactId>cldr-to-icu</artifactId>
     <version>1.0-SNAPSHOT</version>
     <build>
@@ -70,32 +78,12 @@
         </plugins>
     </build>
 
-    <!-- This is where the snapshots of the CLDR API and additional auxiliary JAR files are held. -->
-    <repositories>
-        <repository>
-            <id>local-maven-repo</id>
-            <url>file:///${project.basedir}/lib</url>
-        </repository>
-    </repositories>
-
     <dependencies>
-        <!-- Local dependencies (see lib/README.txt). -->
-        <dependency>
-            <groupId>org.unicode.cldr</groupId>
-            <artifactId>cldr-api</artifactId>
-            <version>0.1-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>com.ibm.icu</groupId>
-            <artifactId>icu-utilities</artifactId>
-            <version>0.1-SNAPSHOT</version>
-        </dependency>
-
         <!-- ICU4J - which should be kept as up-to-date as possible. -->
         <dependency>
             <groupId>com.ibm.icu</groupId>
             <artifactId>icu4j</artifactId>
-            <version>64.2</version>
+            <version>67.1</version>
         </dependency>
 
         <!-- Useful common libraries. Note that some of the code in the CLDR library is also
diff --git a/tools/cldr/lib/README.txt b/tools/cldr/lib/README.txt
new file mode 100644
index 0000000..1d5d980
--- /dev/null
+++ b/tools/cldr/lib/README.txt
@@ -0,0 +1,82 @@
+*********************************************************************
+*** © 2019 and later: Unicode, Inc. and others.                   ***
+*** License & terms of use: http://www.unicode.org/copyright.html ***
+*********************************************************************
+
+What is this directory and why is it empty?
+-------------------------------------------
+
+This is the root of a local Maven repository which needs to be populated before
+code which uses the CLDR data API can be executed.
+
+To do this, you need to have a local copy of the CLDR project configured on your
+computer and be able able to build the API jar file and copy an existing utility
+jar file. In the examples below it is assumed that $CLDR_ROOT references this
+CLDR release.
+
+Setup
+-----
+
+This project relies on the Maven build tool for managing dependencies and uses
+Ant for configuration purposes, so both will need to be installed. On a Debian
+based system, this should be as simple as:
+
+$ sudo apt-get install maven ant
+
+
+Installing the CLDR API jar
+---------------------------
+
+From this directory:
+
+$ ./install-cldr-jars.sh "$CLDR_ROOT"
+
+
+Manually installing the CLDR API jar
+------------------------------------
+
+Only follow these remaining steps if the installation script isn't suitable or
+doesn't work on your system.
+
+To regenerate the CLDR API jar you need to build the "jar" target manually
+using the Ant build.xml file in the "tools/java" directory of the CLDR project:
+
+$ cd <CLDR_ROOT>/tools/java
+$ ant clean jar
+
+This should result in the cldr.jar file being built into that directory, which
+can then be installed as a Maven dependency as described above.
+
+
+Updating local Maven repository
+-------------------------------
+
+To update the local Maven repository (e.g. to install the CLDR jar) then from
+this directory (lib/) you should run:
+
+$ mvn install:install-file \
+  -DgroupId=org.unicode.cldr \
+  -DartifactId=cldr-api \
+  -Dversion=0.1-SNAPSHOT \
+  -Dpackaging=jar \
+  -DgeneratePom=true \
+  -DlocalRepositoryPath=. \
+  -Dfile=<CLDR_ROOT>/tools/java/cldr.jar
+
+And if you have updated one of these libraries then from the main project
+directory (i.e. the directory the Maven pom.xml file(s) are in) run:
+
+$ mvn dependency:purge-local-repository -DsnapshotsOnly=true
+
+After doing this, you should see something like the following list of files in
+this directory:
+
+README.txt   <-- this file
+org/unicode/cldr/cldr-api/maven-metadata-local.xml
+org/unicode/cldr/cldr-api/0.1-SNAPSHOT/maven-metadata-local.xml
+org/unicode/cldr/cldr-api/0.1-SNAPSHOT/cldr-api-0.1-SNAPSHOT.pom
+org/unicode/cldr/cldr-api/0.1-SNAPSHOT/cldr-api-0.1-SNAPSHOT.jar
+
+Finally, if you choose to update the version number of the snapshot, then also
+update all the the pom.xml files which reference it (but this is unlikely to be
+necessary).
diff --git a/tools/cldr/cldr-to-icu/install-cldr-jars.sh b/tools/cldr/lib/install-cldr-jars.sh
similarity index 80%
rename from tools/cldr/cldr-to-icu/install-cldr-jars.sh
rename to tools/cldr/lib/install-cldr-jars.sh
index aedcf9a..16f7732 100755
--- a/tools/cldr/cldr-to-icu/install-cldr-jars.sh
+++ b/tools/cldr/lib/install-cldr-jars.sh
@@ -48,21 +48,20 @@
 # First require that we are run from the same directory as the script.
 ROOT_DIR="$(realpath $(dirname $0))"
 if [[ "${ROOT_DIR}" != "$(realpath ${PWD})" ]] ; then
-  echo "WARNING: Shell script should be run from the project root directory"
+  echo "WARNING: Shell script should be run from the Maven lib/ directory"
   echo "Current directory:"
   echo "  ${PWD}"
-  echo "Project root direcory (where this script is):"
+  echo "Maven lib/ direcory (where this script is):"
   echo "  ${ROOT_DIR}"
-  read -p "Change to project root and continue? " -n 1 -r
+  read -p "Change to lib/ directory and continue? " -n 1 -r
   echo
-  [[ "${REPLY}" =~ ^[Yy]$ ]] || die "Script must be run from the project root directory"
+  [[ "${REPLY}" =~ ^[Yy]$ ]] || die "Script must be run from the Maven lib/ directory"
   cd "$ROOT_DIR"
 fi
 
 # Check for some expected environmental things early.
 which ant > /dev/null || die "Cannot find Ant executable 'ant' in the current path."
 which mvn > /dev/null || die "Cannot find Maven executable 'mvn' in the current path."
-[[ -d "lib" ]] || die "Cannot find expected 'lib' directory in: $PWD"
 
 # Check there's one argument that points at a directory (or a symbolic link to a directory).
 (( $# == 1 )) && [[ -d "$1" ]] || die "Usage: ./install-cldr-jars.sh <CLDR-root-directory>"
@@ -79,13 +78,9 @@
 echo "Building CLDR JAR file..."
 run_with_logging ant -f ./build.xml clean jar
 [[ -f "cldr.jar" ]] || die "Error creating cldr.jar file"
-[[ -f "libs/utilities.jar" ]] || die "Cannot find libs/utilities.jar"
 
 popd > /dev/null
 
-# Install both required CLDR jars in the lib/ directory.
-pushd "${ROOT_DIR}/lib" > /dev/null || die "Cannot change to lib directory"
-
 # The -B flag is "batch" mode and won't mess about with escape codes in the log file.
 echo "Installing CLDR JAR file..."
 run_with_logging mvn -B install:install-file \
@@ -97,19 +92,6 @@
   -DlocalRepositoryPath=. \
   -Dfile="${CLDR_TOOLS_DIR}/cldr.jar"
 
-echo "Installing CLDR utilities JAR file..."
-run_with_logging mvn -B install:install-file \
-  -DgroupId=com.ibm.icu \
-  -DartifactId=icu-utilities \
-  -Dversion=0.1-SNAPSHOT \
-  -Dpackaging=jar \
-  -DgeneratePom=true \
-  -DlocalRepositoryPath=. \
-  -Dfile="${CLDR_TOOLS_DIR}/libs/utilities.jar"
-
-popd > /dev/null
-
-# We are back in the root directory now.
 echo "Syncing local Maven repository..."
 run_with_logging mvn -B dependency:purge-local-repository -DsnapshotsOnly=true
 
diff --git a/tools/cldr/lib/pom.xml b/tools/cldr/lib/pom.xml
new file mode 100644
index 0000000..41da0b1
--- /dev/null
+++ b/tools/cldr/lib/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- © 2020 and later: Unicode, Inc. and others.
+     License & terms of use: http://www.unicode.org/copyright.html
+     See README.txt for instructions on updating the local repository.
+     -->
+<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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- This POM file acts as a parent POM file for any tool which is built
+         via Maven and requires access to the CLDR data APIs. This POM file
+         and the other files in this directory encapsulate the somewhat messy
+         task of including the Ant-built CLDR JAR file in Maven projects. -->
+
+    <!-- Declares this to be a POM that's included by other POM files. -->
+    <packaging>pom</packaging>    
+    
+    <!-- This must match any child POM file's <parent> declaration. -->         
+    <groupId>org.unicode.icu</groupId>
+    <artifactId>cldr-lib</artifactId>
+    <version>1.0</version>
+    
+    <!-- Important: The "${project.basedir}" property is the directory of the
+         child POM file, not this directory (and there's no easy way in Maven
+         to identify the absolute path of a parent POM file). However since
+         child POM files should have a <parent> declaration with the relative
+         path in it, we can use that. Note however that this is a bit fragile
+         and relies on <relativePath> being a directory, not a POM file. -->
+    <repositories>
+        <repository>
+            <id>local-maven-repo</id>
+            <url>file://${project.basedir}/${project.parent.relativePath}</url>
+        </repository>
+    </repositories>
+    
+    <!-- Ant-built JAR file(s) installed into the local Maven repository in this
+         directory by the 'install-cldr-jars.sh' script. -->
+    <dependencies>
+        <dependency>
+            <groupId>org.unicode.cldr</groupId>
+            <artifactId>cldr-api</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>
+