Skip to content

Commit f531bbd

Browse files
authored
Update instructions for Eclipse usage after codebase Mavenization (#188)
1 parent 42e4c87 commit f531bbd

File tree

7 files changed

+47
-201
lines changed

7 files changed

+47
-201
lines changed

.github/workflows/cli-build-instructions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ jobs:
3636
${{ runner.os }}-maven-
3737
- name: Set up in-source output dir
3838
run: |
39-
mkdir -p output/Generated/BIN
39+
mkdir -p Generated/BIN
4040
- name: Initialize Maven settings for all Maven commands
4141
run: mvn -s .github/workflows/mvn-settings.xml -B compile install -DskipTests=true
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444
- name: Run command - Make Unicode Files
45-
run: MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml exec:java -Dexec.mainClass="org.unicode.text.UCD.Main" -Dexec.args="version 15.0.0 build MakeUnicodeFiles" -pl unicodetools -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd output/Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=15.0.0
45+
run: MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml exec:java -Dexec.mainClass="org.unicode.text.UCD.Main" -Dexec.args="version 15.0.0 build MakeUnicodeFiles" -pl unicodetools -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=15.0.0
4646
env:
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4848
- name: Run command - Build and Test
49-
run: MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml package -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd output/Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=15.0.0
49+
run: MAVEN_OPTS="-ea" mvn -s .github/workflows/mvn-settings.xml package -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=15.0.0
5050
env:
5151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5252

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ x64/
6464
x86/
6565

6666
# Files
67+
.project
68+
.classpath
6769
Makefile
6870
Makefile.local
6971
build-local.properties

UnicodeJsps/.classpath

Lines changed: 0 additions & 54 deletions
This file was deleted.

UnicodeJsps/.project

Lines changed: 0 additions & 48 deletions
This file was deleted.

UnicodeJspsTest/.classpath

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/build.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ git clone https://github.com/unicode-org/cldr.git
6868
```
6969
2. In the root folder of the `unicodetools` local working copy, create the `Generated/BIN` folder structure
7070
1. (Eclipse users can do this graphically by following the corresponding step in the Eclipse section below)
71-
1. At the command-line: `cd unicodetools; mkdir -p output/Generated/BIN`
71+
1. At the command-line: `cd unicodetools; mkdir -p Generated/BIN`
7272

7373
##### Notes for both out-of-source and in-source build workspaces
7474

@@ -93,18 +93,23 @@ Currently, some tests run on the generated output files of a tool (ex: in order
9393
1. Edit the cldr-code project’s Build Path:
9494
Under “Order and Export”, set the check mark next to “Maven Dependencies”
9595
so that CLDR makes its dependencies available to the Unicode Tools project.
96-
3. Import the unicodetools project into Eclipse. (Using Maven: General > Existing Projects into Workspace)
97-
4. Also create the project **and directory** Generated. Various results are
98-
deposited there. You need the directory, but the Eclipse project is optional.
99-
1. New... -> Project... -> General/Project
100-
2. Project Name=Generated
101-
3. Uncheck "Use default location" (so that it's not inside your Eclipse workspace)
102-
4. Browse or type a folder path like `Generated` that is a sibling to the top-level `unicodetools` directory
103-
1. Create this folder
104-
2. Create a subfolder BIN
105-
5. Project > Clean... > Clean all projects is your friend
106-
107-
### Running commands for Unicode Tools tasks
96+
3. Import the unicodetools project into Eclipse as a Maven project.
97+
1. If your installation of Eclipse does not already include Maven project support, install the [M2Eclipse plugin for Maven support in Eclipse](https://www.eclipse.org/m2e/).
98+
1. You can check if the M2Eclipse plugin is installed by looking for the Eclipse "m2" icon in the help box at Help > About (or Eclipse > About Eclipse on macOS).
99+
2. If M2Eclipse is not installed, click [here for installation tips](https://www.vogella.com/tutorials/EclipseMaven/article.html#installation-and-configuration-of-maven-for-eclipse).
100+
1. Import the Unicode Tools working copy directory as an Eclipse Maven project via
101+
1. File > Import ... > Maven > Existing Maven Projects. Note: if `Maven` and `Existing Maven Projects` don't appear as a top-level category and sub-option in the initial Import screen of the wizard, then the Eclipse plugin for Maven support has not been installed yet, and see above.
102+
2. Click Next. In the Root Directory field find the location of the working copy directory. Each pom.xml should be detected and selected in the Projects tree selection widget below. Click Finish to finish importing the Eclipse project.
103+
4. Set up a run configuration for building and testing of the entire project using Maven
104+
1. Run > Run Configurations ... > Maven Build, then click the New Launch Configuration icon above
105+
2. Name: `Build and Test`
106+
3. Main > Base Directory > Workspace > unicodetools-parent > OK. The text field should be auto-populated with `${workspace_loc:/unicodetools-parent}`
107+
4. Main > Goals: `package`
108+
5. JRE > VM Arguments..., then set any VM arguments described below. (Example: `-ea`)
109+
6. Ensure that the system properties are set (see section below, "Setting system properties").
110+
7. Apply
111+
8. Run
112+
6. Project > Clean... > Clean all projects is your friend
108113

109114
#### Setting system properties
110115

@@ -115,8 +120,9 @@ For command-line users:
115120
- System properties are specified in this fashion for Maven (same as it is for the JVM CLI): `-Dvar1=path1 -Dvar2=path2 ...`
116121

117122
For Eclipse users:
118-
- You can set these for each single tool in the Run > Debug Configurations... > (x)= Arguments tab > VM arguments
119-
- Or you can set the common variables globally in Window > Preferences... > Java > Installed JREs > select the active JRE > Edit... > Default VM arguments: `-Dvar1=path1 -Dvar2=path2 ...`.
123+
- Set the common variables globally in Window > Preferences... > Java > Installed JREs > select the active JRE > Edit... > Default VM arguments: `-Dvar1=path1 -Dvar2=path2 ...`.
124+
* This approach is recommended to avoid repeating setting the variables for each command. Examples of run configurations below will assume this approach and omit these globally shared variables.
125+
- Alternatively, you can set these for each single command/tool that you configure in the Run > Debug Configurations... > (x)= Arguments tab > VM arguments
120126

121127
#### Enabling assertions
122128

@@ -136,23 +142,37 @@ All commands must be run in the root of the `unicodetools` repository local work
136142

137143
#### Initialization command
138144

139-
The following command must be run first before all other commands. This command initializes ____ (?).
140-
141-
```
142-
mvn -s .github/workflows/mvn-settings.xml -B compile
143-
```
145+
Run the "Build and Test" command below to compile all of the source files. Some commands only execute a single Java class, but the Java .class file can only be found after Maven has compiled it from source.
144146

145147
#### All other commands
146148

147149
Common tasks for Unicode Tools are listed below with example CLI commands with example argument values that they need:
148150

149151
- Make Unicode Files:
150152
* Out-of-source build: `mvn -s .github/workflows/mvn-settings.xml exec:java -Dexec.mainClass="org.unicode.text.UCD.Main" -Dexec.args="version 14.0.0 build MakeUnicodeFiles" -pl unicodetools -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=14.0.0`
151-
* In-source build: `MAVEN_OPTS="-ea" mvn exec:java -Dexec.mainClass="org.unicode.text.UCD.Main" -Dexec.args="version 14.0.0 build MakeUnicodeFiles" -pl unicodetools -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd output/Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=14.0.0`
153+
* In-source build: `MAVEN_OPTS="-ea" mvn exec:java -Dexec.mainClass="org.unicode.text.UCD.Main" -Dexec.args="version 14.0.0 build MakeUnicodeFiles" -pl unicodetools -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=14.0.0`
152154

153155
- Build and Test:
154156
* Out-of-source build: `MAVEN_OPTS="-ea" mvn package -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=14.0.0`
155-
* In-source build: `MAVEN_OPTS="-ea" mvn package -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd output/Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=14.0.0`
157+
* In-source build: `MAVEN_OPTS="-ea" mvn package -DCLDR_DIR=$(cd ../cldr ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd Generated; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=14.0.0`
158+
159+
#### Running commands in Eclipse
160+
161+
For each individual command in Unicode Tools described above, you can configure a Launch Configuration in one of two ways.
162+
163+
1. Just like the Build and Test run config described above, which uses Maven, with the following command and extra changes:
164+
1. From Run > Run Configurations ..., select the previous "Build and Test" configuration. Then select the "Duplicate" button above to create a new duplicate run config. Now make the following changes.
165+
2. Name: [command name goes here] (ex: `UCD Make Unicode Files`)
166+
3. Main > Goals: `-pl unicodetools compile exec:java` (the argument for the subproject list flag `-pl` assumes that the class with the main method is in the subdirectory `unicodetools/src/main/java`)
167+
4. In the environment variables section, also set the class containing the main method and the command's CLI args (ex: name = `exec.mainClass`, value = `"org.unicode.text.UCD.Main"`; name = `exec.args`, value = `"version 15.0.0 build MakeUnicodeFiles"`)
168+
2. Create a typical Eclipse run configuration for running a Java class with a main file
169+
1. Run > Run Configurations ... > Java Application, then click the New Launch Configuration icon above
170+
2. Name: [command name goes here] (ex: `UCD Make Unicode Files`)
171+
3. Project: `unicodetools`
172+
4. Main class: [main class path] (ex: `org.unicode.text.UCD.Main`)
173+
5. Arguments > Program arguments: [main class args] (ex: `version 15.0.0 build MakeUnicodeFiles`)
174+
6. Arguments > VM arguments: [any VM arguments] (ex: `-ea`)
175+
7. Keep in mind that in this approach, you may need to run the Build and Test run config to ensure the latest source code has been compiled by Maven before executing it. For example, if running the run config produces an error like `Error: Could not find or load main class org.unicode.text.UCD.Main Caused by: java.lang.ClassNotFoundException ...`, then you must run the Build and Test run config for Maven to build the yet-uncompiled Java classes into `./unicodetools/target/classes`
156176

157177
### Updating CLDR and ICU versions
158178

unicodetools/.classpath

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)