@@ -67,8 +67,8 @@ compiler plugin. To do this you need to explicitly configure two directories:
6767 this directory.
6868- ` -targetroot:PATH ` : the absolute path to the directory where to generate
6969 SemanticDB file. This directory can be anywhere on your file system.
70- Alternatively, pass in ` -targetroot:javac-classes-directory `
71- for the plugin to automatically use the ` javac ` output directory.
70+ Alternatively, pass in ` -targetroot:javac-classes-directory ` for the plugin to
71+ automatically use the ` javac ` output directory.
7272
7373If you're using Gradle.
7474
@@ -150,3 +150,41 @@ into LSIF.
150150❯ file dump.lsif
151151dump.lsif: JSON data
152152```
153+
154+ ## Step 5 (optional): Enable cross-repository navigation
155+
156+ By default, the ` dump.lsif ` file only enables navigation within the local
157+ repository. You can optionally enable cross-repository navigation by creating
158+ one of the following files in the SemanticDB _ targetroot_ directory (the path in
159+ ` -Xplugin:semanticdb -targeroot:PATH ` ).
160+
161+ - ` javacopts.txt ` : line-separated list of Java compiler options that got passed
162+ to the compiler. For example,
163+ ``` sh
164+ $ cat $TARGETROOT /javacopts.txt
165+ -Xlint
166+ -classpath
167+ -path/to/dependency1.jar:/path/to/dependency2.jar
168+ -d
169+ /path/to/classes/directory
170+ /path/to/com/example/Main.java
171+ ```
172+ The ` javacopts.txt ` file format can only be used if the jars on the dependency
173+ classpath have sibling ` .pom ` files. In some build tools like Gradle, the POM
174+ files are not siblings to the jars on the classpath so the ` javacopts.txt `
175+ format cannot be used.
176+ - ` dependencies.txt ` : a tab-separated values files where the columns are: group
177+ ID, artifact ID, version and jar path. For example,
178+ ``` sh
179+ $ cat $TARGETROOT /dependencies.txt
180+ junit junit 4.13.2 /path/to/junit.jar
181+ org.hamcrest hamcrest-core 1.3 /path/to/hamcrest-core.jar
182+ ```
183+ The ` dependencies.txt ` format is used by lsif-java to map symbols such as
184+ ` org.junit.Assert ` to Maven co-ordinates like ` junit:junit:4.13.2 ` . As long as
185+ your Sourcegraph instance has another repository that defines that symbol, the
186+ cross-repository navigation should succeed. Only jar files are supported at
187+ the moment, classes directories are ignored.
188+
189+ Cross-repository navigation is a feature that allows "goto definition" and "find
190+ references" to show results from multiple repositories.
0 commit comments