Skip to content

Commit

Permalink
[improve][doc] Update links to the contribute guide (#18509)
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
Co-authored-by: momo-jun <[email protected]>
  • Loading branch information
tisonkun and momo-jun authored Nov 17, 2022
1 parent 8a08b5a commit 6f6e32e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 153 deletions.
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@

## Contributing to Apache Pulsar

We would love for you to contribute to Apache Pulsar and make it even better!
Please check the [Contributing to Apache Pulsar](https://pulsar.apache.org/contributing/)
page before starting to work on the project.
We would love for you to contribute to Apache Pulsar and make it even better! Please check the [Apache Pulsar Contributing Guide](https://pulsar.apache.org/contribute/) before starting to work on the project.
180 changes: 32 additions & 148 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,39 +100,39 @@ components in the Pulsar ecosystem, including connectors, adapters, and other la

- pulsar ver > 2.10 and master branch

| Pulsar Components | Java Version |
| ----------------- | :-----------: |
| Broker | 17 |
| Functions / IO | 17 |
| CLI | 17 |
| Java Client | 8 or 11 or 17 |
| Components | Java Version |
|----------------|:-------------:|
| Broker | 17 |
| Functions / IO | 17 |
| CLI | 17 |
| Java Client | 8 or 11 or 17 |

- 2.8 <= pulsar ver <= 2.10

| Pulsar Components | Java Version |
| ----------------- | :----------: |
| Broker | 11 |
| Functions / IO | 11 |
| CLI | 8 or 11 |
| Java Client | 8 or 11 |
| Components | Java Version |
|----------------|:------------:|
| Broker | 11 |
| Functions / IO | 11 |
| CLI | 8 or 11 |
| Java Client | 8 or 11 |

- pulsar ver < 2.8

| Pulsar Components | Java Version |
| ----------------- | :----------: |
| All | 8 or 11 |
| Components | Java Version |
|------------|:------------:|
| All | 8 or 11 |

## Build Pulsar

### Requirements

- JDK

| Pulsar Version | JDK Version |
| ----------------- | :----------: |
| master and 2.11 + | [JDK 17](https://adoptium.net/?variant=openjdk17) |
| 2.8 / 2.9 / 2.10 | [JDK 11](https://adoptium.net/?variant=openjdk11) |
| 2.7 - | [JDK 8](https://adoptium.net/?variant=openjdk8) |
| Pulsar Version | JDK Version |
|-------------------|:-------------------------------------------------:|
| master and 2.11 + | [JDK 17](https://adoptium.net/?variant=openjdk17) |
| 2.8 / 2.9 / 2.10 | [JDK 11](https://adoptium.net/?variant=openjdk11) |
| 2.7 - | [JDK 8](https://adoptium.net/?variant=openjdk8) |

- Maven 3.6.1+
- zip
Expand All @@ -145,6 +145,7 @@ components in the Pulsar ecosystem, including connectors, adapters, and other la
> It's better to use CMD rather than Powershell on Windows. Because maven will activate the `windows` profile which runs `rename-netty-native-libs.cmd`.
### Build

Compile and install:

```bash
Expand All @@ -159,7 +160,7 @@ $ mvn -pl module-name (e.g: pulsar-broker) install -DskipTests

### Minimal build (This skips most of external connectors and tiered storage handlers)

```
```bash
mvn install -Pcore-modules,-main -DskipTests
```

Expand Down Expand Up @@ -191,21 +192,18 @@ Check https://pulsar.apache.org for documentation and examples.

## Build custom docker images

Docker images must be built with Java 8 for `branch-2.7` or previous branches because of
[issue 8445](https://github.com/apache/pulsar/issues/8445).
Java 11 is the recommended JDK version in `branch-2.8`, `branch-2.9` and `branch-2.10`.
Java 17 is the recommended JDK version in `master`.
* Docker images must be built with Java 8 for `branch-2.7` or previous branches because of [ISSUE-8445](https://github.com/apache/pulsar/issues/8445).
* Java 11 is the recommended JDK version in `branch-2.8`, `branch-2.9` and `branch-2.10`.
* Java 17 is the recommended JDK version in `master`.

This builds the docker images `apachepulsar/pulsar-all:latest` and `apachepulsar/pulsar:latest`.
The following command builds the docker images `apachepulsar/pulsar-all:latest` and `apachepulsar/pulsar:latest`:

```bash
mvn clean install -DskipTests
mvn package -Pdocker,-main -am -pl docker/pulsar-all -DskipTests
```

After the images are built, they can be tagged and pushed to your custom repository.
Here's an example of a bash script that tags the docker images with the current version and git revision and
pushes them to `localhost:32000/apachepulsar`.
After the images are built, they can be tagged and pushed to your custom repository. Here's an example of a bash script that tags the docker images with the current version and git revision and pushes them to `localhost:32000/apachepulsar`.

```bash
image_repo_and_project=localhost:32000/apachepulsar
Expand All @@ -221,134 +219,20 @@ docker push ${image_repo_and_project}/pulsar:$tag

## Setting up your IDE

Apache Pulsar is using [lombok](https://projectlombok.org/) so you have to ensure your IDE setup with
required plugins.

### IntelliJ

#### Configure Project JDK to Java 17 JDK

1. Open **Project Settings**.

Click **File** -> **Project Structure** -> **Project Settings** -> **Project**.

2. Select the JDK version.

From the JDK version drop-down list, select **Download JDK...** or choose an existing recent Java 17 JDK version.

3. In the download dialog, select version **17**. You can pick a version from many vendors. Unless you have a specific preference, choose **Eclipse Temurin (AdoptOpenJDK (Hotspot))**.

#### Configure Java version for Maven in IntelliJ

1. Open Maven Importing Settings dialog by going to
**Settings** -> **Build, Execution, Deployment** -> **Build Tools** -> **Maven** -> **Importing**.

2. Choose **Use Project JDK** for **JDK for Importer** setting. This uses the Java 17 JDK for running Maven
when importing the project to IntelliJ. Some of the configuration in the Maven build is conditional based on
the JDK version. Incorrect configuration gets chosen when the "JDK for Importer" isn't the same as the "Project JDK".

3. Validate that the JRE setting in **Maven** -> **Runner** dialog is set to **Use Project JDK**.

#### Configure annotation processing in IntelliJ

1. Open Annotation Processors Settings dialog box by going to
**Settings** -> **Build, Execution, Deployment** -> **Compiler** -> **Annotation Processors**.

2. Select the following buttons:

1. **Enable annotation processing**
2. **Obtain processors from project classpath**
3. Store generated sources relative to: **Module content root**

3. Set the generated source directories to be equal to the Maven directories:

1. Set "Production sources directory:" to "target/generated-sources/annotations".
2. Set "Test sources directory:" to "target/generated-test-sources/test-annotations".

4. Click **OK**.

5. Install the lombok plugin in intelliJ.

#### Configure code style

1. Open Code Style Settings dialog box by going to **Settings** -> **Editor** -> **Code Style**.

2. Click on the :gear: symbol -> **Import scheme** -> **IntelliJ IDEA code style XML**

3. Pick the file `${pulsar_dir}/src/idea-code-style.xml`

4. On the dialog box that opens, click **OK**.

5. Ensure the scheme you just created is selected in **Scheme** dropdown then click **OK**.

#### Configure Checkstyle

1. Install the Checkstyle-IDEA plugin.

2. Open Checkstyle Settings dialog box by going to **Settings** -> **Tools** -> **Checkstyle**.

3. Set **Checkstyle version** to **8.37**.

4. Set **Scan scope** to **Only Java sources (including tests)**.

5. Click **+** button in the **Configuration** section to open a dialog to choose the checkfile file.

1. Enter a **Description**. For example, Pulsar.
2. Select **Use a local checkstyle file**.
3. Set **File** to **buildtools/src/main/resources/pulsar/checkstyle.xml**.
4. Select **Store relative to project location**.
5. Click **Next** -> **Next** -> **Finish**.

6. Activate the configuration you just added by toggling the corresponding box.

7. Click **OK**.

#### Further configuration in IntelliJ

- When working on the Pulsar core modules in IntelliJ, reduce the number of active projects in IntelliJ to speed up IDE actions and reduce unrelated IDE warnings.

- In IntelliJ's Maven UI's tree view under "Profiles"
- Activate "core-modules" Maven profile
- De-activate "main" Maven profile
- Run the "Reload All Maven Projects" action from the Maven UI toolbar. You can also find the action by the name in the IntelliJ "Search Everywhere" window that gets activated by pressing the **Shift** key twice.

- Run the "Generate Sources and Update Folders For All Projects" action from the Maven UI toolbar. You can also find the action by the name in the IntelliJ "Search Everywhere" window that gets activated by pressing the **Shift** key twice. Running the action takes about 10 minutes for all projects. This is faster when the "core-modules" profile is the only active profile.

#### IntelliJ usage tips

- In the case of compilation errors with missing Protobuf classes, ensure to run the "Generate Sources and Update Folders For All Projects" action.

- All of the Pulsar source code doesn't compile properly in IntelliJ and there are compilation errors.
- Use the "core-modules" profile if working on the Pulsar core modules since the source code for those modules can be compiled in IntelliJ.
- Sometimes it might help to mark a specific project ignored in IntelliJ Maven UI by right-clicking the project name and select **Ignore Projects** from the menu.
- Currently, it is not always possible to run unit tests directly from the IDE because of the compilation issues. As a workaround, individual test classes can be run by using the `mvn test -Dtest=TestClassName` command.
- The above steps have all been performed, but a test still won't run.
- In this case, try the following steps:
1. Close IntelliJ.
2. Run `mvn clean install -DskipTests` on the command line.
3. Reopen IntelliJ.
- If that still doesn't work:
1. Verify Maven is using a supported version. Currently, the supported version of Maven is specified in the
<requireMavenVersion> section of the main pom.xml file.
2. Try "restart and clear caches" in IntelliJ and repeat the above steps to reload projects and generate sources.

### Eclipse

Follow the instructions [here](https://howtodoinjava.com/automation/lombok-eclipse-installation-examples/)
to configure your Eclipse setup.
Read https://pulsar.apache.org/contribute/setup-ide for setting up IntelliJ IDEA or Eclipse for developing Pulsar.

## Documentation

> **Tip**
> **Note**:
>
> For how to make contributions to Pulsar documentation, see [Pulsar Documentation Contribution Guide](https://docs.google.com/document/d/11DTnNPpvcPrebLkMAFcDEIFlD8ARD-k6F-LXoIwdD9Y/edit#).
> For how to make contributions to Pulsar documentation, see [Pulsar Documentation Contribution Guide](https://pulsar.apache.org/contribute/document-intro/).
## Contact

##### Mailing lists

| Name | Scope | | | |
| :-------------------------------------------------------- | :------------------------------ | :---------------------------------------------------- | :-------------------------------------------------------- | :----------------------------------------------------------------- |
| Name | Scope | Subscribe | Unsubscribe | Archives |
|:----------------------------------------------------------|:--------------------------------|:------------------------------------------------------|:----------------------------------------------------------|:-------------------------------------------------------------------|
| [[email protected]](mailto:[email protected]) | User-related discussions | [Subscribe](mailto:[email protected]) | [Unsubscribe](mailto:[email protected]) | [Archives](http://mail-archives.apache.org/mod_mbox/pulsar-users/) |
| [[email protected]](mailto:[email protected]) | Development-related discussions | [Subscribe](mailto:[email protected]) | [Unsubscribe](mailto:[email protected]) | [Archives](http://mail-archives.apache.org/mod_mbox/pulsar-dev/) |

Expand Down
4 changes: 2 additions & 2 deletions site2/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Pulsar Documentation Contribution Overview
# Pulsar Documentation Contribution Guide

Read https://pulsar.apache.org/contribute/documentation/overview for more information.
Read https://pulsar.apache.org/contribute/document-intro/ for more information.

0 comments on commit 6f6e32e

Please sign in to comment.