xref: /aosp_15_r20/external/google-java-format/eclipse_plugin/README.md (revision 10816b529e1d7005ca788e7b4c5efd1c72957e26)
1*10816b52SSorin Basca# Google Java Format Eclipse Plugin
2*10816b52SSorin Basca
3*10816b52SSorin Basca## Enabling
4*10816b52SSorin Basca
5*10816b52SSorin BascaSee https://github.com/google/google-java-format#eclipse
6*10816b52SSorin Basca
7*10816b52SSorin Basca## Development
8*10816b52SSorin Basca
9*10816b52SSorin Basca### Prerequisites
10*10816b52SSorin Basca
11*10816b52SSorin BascaBefore building the plugin, make sure to run `mvn
12*10816b52SSorin Bascatycho-versions:update-eclipse-metadata` to update the bundle version in
13*10816b52SSorin Basca`META-INF/MANIFEST.MF`.
14*10816b52SSorin Basca
15*10816b52SSorin Basca### Building the Plugin
16*10816b52SSorin Basca
17*10816b52SSorin Basca1) Run `mvn clean package` in the `eclipse_plugin` directory. This will first copy the dependencies
18*10816b52SSorin Bascaof the plugin to `eclipse_plugin/lib/` and then triggers the tycho build that uses these
19*10816b52SSorin Bascadependencies (as declared in `build.properties`) for the actual Eclipse plugin build.<br><br>
20*10816b52SSorin BascaIf you also want to add the build artifact to the local maven repository, you can use
21*10816b52SSorin Basca`mvn clean install -Dtycho.localArtifacts=ignore` instead. Note, however, that you then must use
22*10816b52SSorin Bascathis build command for every build with that specific version number until you clear the build
23*10816b52SSorin Bascaartifact (or the
24*10816b52SSorin Basca[p2-local-metadata.properties](https://wiki.eclipse.org/Tycho/Target_Platform#Locally_built_artifacts))
25*10816b52SSorin Bascafrom your local repository. Otherwise, you might run into issues caused by the build using an
26*10816b52SSorin Bascaoutdated build artifact created by a previous build instead of re-building the plugin. More
27*10816b52SSorin Bascainformation on this issue is given
28*10816b52SSorin Basca[in this thread](https://www.eclipse.org/lists/tycho-user/msg00952.html) and
29*10816b52SSorin Basca[this bug tracker entry](https://bugs.eclipse.org/bugs/show_bug.cgi?id=355367).
30*10816b52SSorin Basca
31*10816b52SSorin Basca2) You can find the built plugin in
32*10816b52SSorin Basca`eclipse_plugin/target/google-java-format-eclipse-plugin-<version>.jar`
33*10816b52SSorin Basca
34*10816b52SSorin Basca#### Building against a local (snapshot) release of the core
35*10816b52SSorin Basca
36*10816b52SSorin BascaWith the current build setup, the Eclipse plugin build pulls the needed build
37*10816b52SSorin Bascaartifacts of the google java format core from the maven repository and copies it
38*10816b52SSorin Bascainto the `eclipse_plugin/lib/` directory.
39*10816b52SSorin Basca
40*10816b52SSorin BascaIf you instead want to build against a local (snapshot) build of the core which
41*10816b52SSorin Bascais not available in a maven repository (local or otherwise), you will have to
42*10816b52SSorin Bascaplace the appropriate version into the `eclipse_plugin/lib/` directory yourself
43*10816b52SSorin Bascabefore the build.
44