diff --git a/README.md b/README.md index 5f9cad34..f87a1718 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,111 @@ To install the updated project files, build the Maven project: mvn install ``` +## Building from Source (Manual Build) + +If you want to build the library from source and share it with someone without publishing to Maven, follow these steps: + +### Prerequisites + +- Java 11 or higher +- [Apache Maven](https://maven.apache.org/install.html) 3.6+ + +### Step 1: Clone the Repository + +```bash +git clone https://github.com/coveo/push-api-client.java.git +cd push-api-client.java +``` + +### Step 2: Build the JAR + +```bash +mvn clean package -DskipTests +``` + +This will generate the following files in the `target/` directory: + +- `push-api-client.java-.jar` — The compiled library +- `push-api-client.java--sources.jar` — Source code (for IDE integration) + +### Step 3: Install to Local Maven Repository (Optional) + +If you want to use the library in another local Maven project: + +```bash +mvn clean install -DskipTests +``` + +This installs the JAR to your local `~/.m2/repository`, making it available to other projects on your machine. + +### Step 4: Share the JAR + +To share the built JAR with someone else: + +1. **Send the JAR file**: Share the `target/push-api-client.java-.jar` file directly. + +2. **Recipient adds JAR to their project**: + + **Option A — Install to their local Maven repository:** + + ```bash + mvn install:install-file \ + -Dfile=push-api-client.java-.jar \ + -DgroupId=com.coveo \ + -DartifactId=push-api-client.java \ + -Dversion= \ + -Dpackaging=jar + ``` + + Then add the dependency to their `pom.xml`: + + ```xml + + com.coveo + push-api-client.java + + + ``` + + **Option B — Use system scope (not recommended for production):** + + ```xml + + com.coveo + push-api-client.java + + system + ${project.basedir}/lib/push-api-client.java-.jar + + ``` + + **Option C — For Gradle projects:** + + Place the JAR in a `libs/` folder and add: + + ```groovy + dependencies { + implementation files('libs/push-api-client.java-.jar') + } + ``` + +### Running Tests + +To run the test suite: + +```bash +mvn test +``` + +### Validating Code Format + +Before contributing, ensure your code follows the project's formatting rules: + +```bash +mvn spotless:check # Check formatting +mvn spotless:apply # Auto-fix formatting issues +``` + ## Usage > See more examples in the `./samples` folder.