diff --git a/README.md b/README.md index 6412a8ac..fba2c261 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,67 @@ # Push API Client -A Coveo Push API Client in Java +A [Coveo Push API](https://docs.coveo.com/en/12/api-reference/push-api) client library for Java. + +## Prerequisites + +The Coveo `push-api-client.java` package is stored on GitHub packages. +You will need a personal access token (classic) with at least `read:packages` scope to install this dependency. + +For details, see [Authenticating to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages) ## Installation -### Step 1: Prerequisites -The Coveo `push-api-client.java` package is stored on Github packages. You will need a personal access token (classic) with at least `read:packages` scope to install this dependency. +### Step 1: Update `settings.xml` -More info, visit [Authenticating to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages) +You can install this GitHub Package with [Apache Maven](https://maven.apache.org/) by editing the `~/.m2/settings.xml` file: -### Step 2: Update `settings.xml` -You can install this GitHub Package with Apache Maven by editing your `~/.m2/settings.xml`: +1. Add a repository definition to the GitHub Package. -#### The repository to the package -Add a definition to the Github Package + ```xml + + github + https://maven.pkg.github.com/coveo/push-api-client.java + + true + + + ``` -```xml - - github - https://maven.pkg.github.com/coveo/push-api-client.java - - true - - -``` +1. Add your GitHub personal access token to install packages from GitHub Packages. + + ```xml + + + github + USERNAME + TOKEN + + + ``` -#### Your GitHub personal access token -Your personal access token required to install packages from Github Packages +### Step 2: Add a Coveo dependency to project + +Add a Coveo dependency to your Maven project by editing the `pom.xml` file. ```xml - - - github - USERNAME - TOKEN - - + + com.coveo + push-api-client.java + 2.3.0 + ``` -### Step 3: Add Coveo dependency to project -Using Maven: - +### Step 3: Install the project files -Add Coveo dependency to your maven project. Instructions on how to do that available in this [URL](https://github.com/coveo/push-api-client.java/packages/1884180). +To install the updated project files, build the Maven project. -### Step 4: Install -Run via command line ```bash mvn install ``` ## Usage -See more examples in the `./samples` folder. +> See more examples in the `./samples` folder. ```java import com.coveo.pushapiclient.DocumentBuilder; @@ -82,45 +91,56 @@ public class PushOneDocument { ``` ## Logging -When pushing multiple documents into your source using a service (e.g. `PushService`, `StreamService`), make sure to configure a **logger** to be able to see what happens. -to do so .. in your `resources` folder. -### Log4j2 XML Configuration Example -To log execution output into the console, use the below `log4j2.xml` configuration: -```xml - - - - - - - - - - - - - - -``` +If you want to push multiple documents to your Coveo organization and use a service for that (e.g. `PushService`, `StreamService`), you may find it useful to configure a **logger** to catch error and warning messages. + +1. Go to your project's root folder. -See [Log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html) for more details. +1. Update the Apache Log4j2 configuration by editing the `log4j2.xml` file. + The following example will print the log execution to the console. -## Local Setup to Contribute + ```xml + + + + + + + + + + + + + + ``` -### Formatting + For more details, see [Log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html). + +## Formatting the code before contributing This project uses [Google Java Format](https://github.com/google/google-java-format), so make sure your code is properly formatted before opening a pull request. + +To enforce code style and formatting rules, run the Maven Spotless plugin: + ```bash mvn spotless:apply ``` ## Release -* Tag the commit following semver. -* Bump version in pom.xml -* mvn -P release clean deploy -* cd into ./target -* jar -cvf bundle.jar push-api-client.java-1.0.0-javadoc.jar push-api-client.java-1.0.0-javadoc.jar.asc push-api-client.java-1.0.0-sources.jar push-api-client.java-1.0.0-sources.jar.asc push-api-client.java-1.0.0.jar push-api-client.java-1.0.0.jar.asc push-api-client.java-1.0.0.pom push-api-client.java-1.0.0.pom.asc -* Log into https://oss.sonatype.org/ -* Upload newly created bundle.jar +1. Tag the commit according to the [semantic versioning](https://semver.org/). + +1. Bump version in `pom.xml`. + +1. Run the following commands: + + 1. `mvn -P release clean deploy`. + + 1. `cd ./target`. + + 1. `jar -cvf bundle.jar push-api-client.java-1.0.0-javadoc.jar push-api-client.java-1.0.0-javadoc.jar.asc push-api-client.java-1.0.0-sources.jar push-api-client.java-1.0.0-sources.jar.asc push-api-client.java-1.0.0.jar push-api-client.java-1.0.0.jar.asc push-api-client.java-1.0.0.pom push-api-client.java-1.0.0.pom.asc` + +1. Log in to https://oss.sonatype.org/. + +1. Upload the newly created `bundle.jar` file.