|
| 1 | +--- |
| 2 | +title: 'Using annotation processor in IDE' |
| 3 | +layout: page |
| 4 | +--- |
| 5 | + |
| 6 | +{% capture v %}0.14{% endcapture %} |
| 7 | +{% capture depUri %}http://search.maven.org/#artifactdetails|org.immutables{% endcapture %} |
| 8 | +-------- |
| 9 | +Overview |
| 10 | +-------- |
| 11 | + |
| 12 | +As of Java 6 annotation processing became part of standard java compiler. |
| 13 | +Java 7 or higher is required to run _Immutables_ annotation processor. |
| 14 | +_Immutables_ annotation processor runs under any Java build tool that uses `javac` as compiler backend. |
| 15 | +(given annotation processing is not disabled in build tool configuration). |
| 16 | +_Eclipse JDT compiler_ (ECJ) also supports this annotation processor. |
| 17 | + |
| 18 | +Nowadays major IDE supports annotation processing out of the box while importing projects. That |
| 19 | +said there are some quirks that may prevent this functionality to function properly. |
| 20 | + |
| 21 | +Annotation processor that is to be plugged into IDE was built as single jar without external dependencies. |
| 22 | + |
| 23 | +- [org.immutables:generate-tool:{{v}}]({{ depUri }}|generate-tool|{{ v }}|jar) |
| 24 | + |
| 25 | +------- |
| 26 | +Eclipse |
| 27 | +------- |
| 28 | + |
| 29 | +If you are using Maven, then m2e could configure annotation processing for you. However for this to work |
| 30 | +m2e-apt connector should be installed first. Install it from Eclipse marketplace, for example: |
| 31 | + |
| 32 | +<img src="pix/eclipse-marketplace.png"> |
| 33 | + |
| 34 | +If it will not work for some reason, you could configure it manually. |
| 35 | + |
| 36 | +Manual configuration tutorial |
| 37 | + |
| 38 | +* [Using Java 6 processors in Eclipse](http://kerebus.com/2011/02/using-java-6-processors-in-eclipse/) |
| 39 | + |
| 40 | + |
| 41 | +Here's and dialog configuration example to manually configure annotation processor that is already in local |
| 42 | +maven repository. One need to enable annotation processing in the project settings, then configure factory path |
| 43 | +to point to annotation processor jar, in this example, by extending M2_REPO classpath variable (defined by m2e). |
| 44 | + |
| 45 | +<img src="pix/eclipse-annotation-processing.png"> |
| 46 | + |
| 47 | +<img src="pix/eclipse-factory-path.png"> |
| 48 | + |
| 49 | + |
| 50 | +_This section to be expanded_ |
| 51 | + |
| 52 | +------------- |
| 53 | +IntelliJ IDEA |
| 54 | +------------- |
| 55 | +IntelliJ IDEA should configure annotation processing automatically |
| 56 | + |
| 57 | + |
| 58 | +<img src="http://blog.jetbrains.com/idea/files/2009/11/settings.png"> |
| 59 | + |
| 60 | +_This section to be expanded_ |
0 commit comments