|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Pull requests for bug fixes are always welcome! |
| 4 | + |
| 5 | +Before submitting new features or changes to current functionality, it is recommended to first |
| 6 | +[open an issue](https://github.com/microsoft/ApplicationInsights-Java/issues/new) |
| 7 | +and discuss your ideas or propose the changes you wish to make. |
| 8 | + |
| 9 | +## Building |
| 10 | + |
| 11 | +In order to build and test this whole repository you need JDK 11+. |
| 12 | + |
| 13 | +### Building from source |
| 14 | + |
| 15 | +Build using Java 11+: |
| 16 | + |
| 17 | +```bash |
| 18 | +java -version |
| 19 | +``` |
| 20 | + |
| 21 | +```bash |
| 22 | +./gradlew assemble |
| 23 | +``` |
| 24 | + |
| 25 | +and then you can find the java agent artifact at |
| 26 | + |
| 27 | +`agent/agent/build/libs/applicationinsights-agent-<version>.jar`. |
| 28 | + |
| 29 | +## IntelliJ setup and troubleshooting |
| 30 | + |
| 31 | +See [IntelliJ setup and troubleshooting](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/intellij-setup-and-troubleshooting.md) |
| 32 | +from the OpenTelemetry Java Instrumentation project. |
| 33 | + |
| 34 | +## Style guide |
| 35 | + |
| 36 | +See the [style guide](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/style-guideline.md). |
| 37 | +from the OpenTelemetry Java Instrumentation project. |
| 38 | + |
| 39 | +## Running a smoke test in Intellij |
| 40 | + |
| 41 | +Pick the smoke test that you want to run, e.g. `MongoTest`. |
| 42 | +If the smoke test is abstract, then pick one of its subclasses, e.g. `MongoTest$Tomcat8Java8Test`. |
| 43 | +Right-click on it and select run. |
| 44 | + |
| 45 | +## Debugging a smoke test in Intellij |
| 46 | + |
| 47 | +Add `-PsmokeTestRemoteDebug=true` to the gradle args, e.g. |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +Then create a Remote JVM Debug configuration, e.g. |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +Then run (not debug) the smoke test as above in [Running the smoke tests from Intellij](#running-a-smoke-test-in-intellij). |
| 56 | + |
| 57 | +The JVM inside the container will wait remote debugger to be attached before starting. |
| 58 | + |
| 59 | +Then go to Run > Debug, and select your Remote JVM Debug configuration. |
| 60 | + |
| 61 | +## Error prone |
| 62 | + |
| 63 | +While developing, if you find errorprone is getting in your way (e.g. it won't let you add |
| 64 | +`System.out.println` to your code), you can disable it by adding the following to your |
| 65 | +`~/.gradle/gradle.properties`: |
| 66 | + |
| 67 | +``` |
| 68 | +disableErrorProne=true |
| 69 | +``` |
0 commit comments