{: .no_toc }
{: .no_toc .text-delta }
ICU4J source layout was changed after 4.2. There are several ways to set up the ICU4J development environment.
Get the source code by following the Quick Start instruction. Go into the icu4j/ directory to see the build.xml file. You can run targets displayed by ant -p.
Main targets:
all Build all primary targetsapireport Run API report generator toolapireportOld Run API report generator tool (Pre Java 5 Style)build-tools Build build-tool classescharset Build charset classescharset-tests Build charset testscharsetCheck Run only the charset testscheck Run the standard ICU4J test suitecheckDeprecated Check consistency between javadoc @deprecated and @Deprecated annotationcheckTest Run only the specified tests of the specified test class or, if no arguments are given, the standard ICU4J test suite.checktags Check API tags before releasecldrUtil Build Utilities for CLDR toolingclean Clean up build outputscollate Build collation classescollate-tests Build core testscollateCheck Run only the collation testscore Build core classescore-tests Build core testscoreCheck Run only the core testscoverageJaCoCo Run the ICU4J unit tests and generate code coverage reportcurrdata Build currency data classesdemos Build demo classesdocs Build API documentsdocsStrict Build API documents with all doclint check enableddraftAPIs Run API collector tool and generate draft API reportexhaustiveCheck Run the standard ICU4J test suite in exhaustive modefindbugs Run FindBugs on all library sub projects.gatherapi Run API database generator toolgatherapiOld Run API database generator tool (Pre Java 5 style)icu4jJar Build ICU4J all-in-one core jaricu4jSrcJar Build icu4j-src.jaricu4jtestsJar Build ICU4J all-in-one test jarindicIMEJar Build indic IME ‘icuindicime.jar’ jar fileinfo Display the build environment informationinit Initialize the environment for build and test. May require internet access.jar Build ICU4J runtime library jar filesjarDemos Build ICU4J demo jar filejdktzCheck Run the standard ICU4J test suite with JDK TimeZonelangdata Build language data classeslocalespi Build Locale SPI classeslocalespi-tests Build Locale SPI testslocalespiCheck Run the ICU4J Locale SPI test suitemain Build ICU4J runtime library classespackaging-tests Build packaging testspackagingCheck Run packaging testsperf-tests Build performance test classesregiondata Build region data classesrelease Build all ICU4J release files for distributionreleaseBinaries Build ICU4J binary files for distributionreleaseCLDR Build release files for CLDR toolingreleaseDocs Build ICU4J API reference doc jar file for distributionreleaseSourceArchiveTgz Build ICU4J source release archive (.tgz)releaseSourceArchiveZip Build ICU4J source release archive (.zip)releaseSrcJars Build ICU4J src jar files for distributionreleaseVer Build all ICU4J release files for distribution with versioned file namesrunTest Run the standard ICU4J test suite without calling any other build targetssamples Build sample classessecure (Deprecated)Build ICU4J API and test classes for running the ICU4J test suite with Java security manager enabledsecureCheck Run the secure (applet-like) ICU4J test suitetest-framework Build test framework classestests Build ICU4J test classestimeZoneCheck Run the complete test for TimeZoneRoundTripAlltools Build tool classestranslit Build translit classestranslit-tests Build translit teststranslitCheck Run the ICU4J Translit test suitetranslitIMEJar Build transliterator IME ‘icutransime.jar’ jar filexliff Build xliff converter toolDefault target: main The typical usage is ant check, which will build main ICU4J libraries and run the standard unit test suite.
For running ant you may need to set up some environment variables first. For example, on Windows:
set ANT_HOME=C:\\ant\\apache-ant-1.7.1 set JAVA_HOME=C:\\Program Files\\Java\\jdk1.5.0_07 set PATH=%JAVA_HOME%\\bin;%ANT_HOME%\\bin;%PATH%
You can pass arguments to the test system by using the ‘testclass’ and ‘testnames’ variables and the ‘checkTest’ target. For example:
| Command Line | Meaning |
|---|---|
ant checkTest -Dtestclass='com.ibm.icu.dev.test.lang.TestUScript' | Runs all the tests in test class ‘TestUScript’. |
ant checkTest -Dtestclass='com.ibm.icu.dev.test.lang.TestUScript' -Dtestnames='TestNewCode,TestHasScript' | Runs the tests TestNewCode and TestHasScript in test class TestUScript. |
ant checkTest -Dtestnames='TestNewCode,TestHasScript' | Error: test class not specified. |
ant checkTest | Runs the standard ICU4J test suite (same as ‘ant check’). |
The JUnit-generated test result reports are in out/junit-results/checkTest. Go into the html/ subdirectory and load index.html into a browser.
#10513 added code coverage target “coverageJaCoCo” in the ICU4J ant build.xml. To run the target:
C:\jacoco-0.7.6set JACOCO_DIR=C:\jacoco-0.7.6Following output report files will be generated in /out/jacoco directory.
Since ICU4J 49M2, JCite (Java Source Code Citation System) is integrated into ICU4J documentation build. To build the API documentation for public release, you must use JCite for embedding some coding examples in the API documentation. To set up the environment:
C:\jcite-1.13.0JCITE_DIR pointing to the directory where JCite files are extracted. - e.g. set JCITE_DIR=C:\jcite-1.13.0<path>/java/jdk. The Javadoc package is in <path>/java/jdk/lib/tools.jar.Note: The ant target “docs” checks if JCITE_DIR is defined or not. If not defined, it will build ICU4J API docs without JCite. In this case, JCite taglet “{@.jcite ....}” won't be resolved and the embedded tag is left unchanged in the output files.
Building Eclipse ICU4J plugin
<icu4j root> directory, and make sure $ ant releaseVer runs clean. <icu4j root>/eclipse-build directory.build-local.properties.template to build-local.properties, edit the properties files<icu4j root>/eclipse-build/out/projects/ICU4J.com.ibm.icu/com.ibm.icu-com.ibm.icu.zipPlugin integration test
<eclipse>/plugins/com.ibm.icu_XX.Y.Z.vYYYYMMDD-HHMM.jar XX.YY.Z is the ICU version, and YYYYMMDD-HHMM is build date. For example, com.ibm.icu_58.2.0.v20170418-1837.jarcom.ibm.icu" in files under <eclipse>/features. The RCP feature has a dependency on the ICU plugin and its feature.xml (e.g. <eclipse>/features/org.eclipse.e4.rcp_1.6.2.v20171129-0543/feature.xml) contains the dependent plugin information. Replace just version attribute to match the version built by above steps. You can leave size attributes unchanged. The current ICU build script does not append hour/minute in plugin jar file, so the version format is XX.Y.Z.vYYYYMMDD. <plugin id="com.ibm.icu" download-size="11775" install-size="26242" version="58.2.0.v20170418-1837" -> "61.1.0.v20180502" unpack="false"/><eclipse>/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info in a text editor, and update the line including com.ibm.icu plugin information.com.ibm.icu,58.2.0.v20170418-1837,plugins/com.ibm.icu_58.2.0.v20170418-1837.jar,4,falsethen becomes ->
com.ibm.icu,**61.1.0.v20190502**,plugins/com.ibm.icu_**61.1.0.v20190502**.jar,4,false
ICU4J plugin test - Note: This is currently broken http://bugs.icu-project.org/trac/ticket/13072
<icu4jroot>/eclipse-build/out/projects/com.ibm.icu.testsSee Release Build