diff options
author | George Fraser <george@fivetran.com> | 2017-04-13 23:39:28 -0700 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2017-04-13 23:39:28 -0700 |
commit | b666991309b04947bce00bee54fc4bf98ae6d77c (patch) | |
tree | 33085f61497f3ad10bd6181872436078e8d9a1b0 /README.md | |
parent | 9b04fee43a4ef69e87eeab799d448eceecadb6ba (diff) | |
download | java-language-server-b666991309b04947bce00bee54fc4bf98ae6d77c.zip |
Support multiple configs
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 41 |
1 files changed, 30 insertions, 11 deletions
@@ -56,14 +56,16 @@ The presence of a `javaconfig.json` file indicates that its parent directory is the root of a Java module. `javaconfig.json` looks like: - { + [{ "sourcePath": ["relative/path/to/source/root", ...], + "classPath": ["some-jar.jar", "some-dir"], "classPathFile": "file-with-classpath-as-contents.txt", "outputDirectory": "relative/path/to/output/root" - } + }, ... more configurations] -The classpath is contained in a separate file, -in the format `entry.jar:another-entry.jar`. +The order is important: VSCode will use the first configuration with a sourcePath that matches the file you are editing. + +The classPathFile is contained in a separate file, in the format `entry.jar:another-entry.jar`. This file is usually generated by a build tool like maven. ### Examples @@ -81,11 +83,16 @@ classpath.txt, where Visual Studio Code will find it. Set the source path, and get the class path from a file: - { + [{ "sourcePath": ["src/main/java"], "classPathFile": "classpath.txt", - "outputDirectory": "target" - } + "outputDirectory": "target/classes" + }, { + "sourcePath": ["src/test/java"], + "classPath": ["target/classes"], + "classPathFile": "test-classpath.txt", + "outputDirectory": "target/test-classes" + }] #### pom.xml @@ -103,16 +110,28 @@ Configure maven to output `classpath.txt` <version>2.9</version> <executions> <execution> - <id>build-classpath</id> + <id>classpath</id> + <phase>generate-sources</phase> + <goals> + <goal>build-classpath</goal> + </goals> + <configuration> + <includeScope>compile</includeScope> + <outputFile>classpath.txt</outputFile> + </configuration> + </execution> + <execution> + <id>test-classpath</id> <phase>generate-sources</phase> <goals> <goal>build-classpath</goal> </goals> + <configuration> + <includeScope>test</includeScope> + <outputFile>test-classpath.txt</outputFile> + </configuration> </execution> </executions> - <configuration> - <outputFile>classpath.txt</outputFile> - </configuration> </plugin> </plugins> </build> |