Skip to content

Commit c3d5fec

Browse files
authored
docs(readme): add package instructions to readme (#184)
* docs(readme): add info to code snippets * docs(readme): add package info to readme
1 parent 8c41bb9 commit c3d5fec

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,111 @@ To install the updated project files, build the Maven project:
6565
mvn install
6666
```
6767

68+
## Building from Source (Manual Build)
69+
70+
If you want to build the library from source and share it with someone without publishing to Maven, follow these steps:
71+
72+
### Prerequisites
73+
74+
- Java 11 or higher
75+
- [Apache Maven](https://maven.apache.org/install.html) 3.6+
76+
77+
### Step 1: Clone the Repository
78+
79+
```bash
80+
git clone https://github.com/coveo/push-api-client.java.git
81+
cd push-api-client.java
82+
```
83+
84+
### Step 2: Build the JAR
85+
86+
```bash
87+
mvn clean package -DskipTests
88+
```
89+
90+
This will generate the following files in the `target/` directory:
91+
92+
- `push-api-client.java-<version>.jar` — The compiled library
93+
- `push-api-client.java-<version>-sources.jar` — Source code (for IDE integration)
94+
95+
### Step 3: Install to Local Maven Repository (Optional)
96+
97+
If you want to use the library in another local Maven project:
98+
99+
```bash
100+
mvn clean install -DskipTests
101+
```
102+
103+
This installs the JAR to your local `~/.m2/repository`, making it available to other projects on your machine.
104+
105+
### Step 4: Share the JAR
106+
107+
To share the built JAR with someone else:
108+
109+
1. **Send the JAR file**: Share the `target/push-api-client.java-<version>.jar` file directly.
110+
111+
2. **Recipient adds JAR to their project**:
112+
113+
**Option A — Install to their local Maven repository:**
114+
115+
```bash
116+
mvn install:install-file \
117+
-Dfile=push-api-client.java-<version>.jar \
118+
-DgroupId=com.coveo \
119+
-DartifactId=push-api-client.java \
120+
-Dversion=<version> \
121+
-Dpackaging=jar
122+
```
123+
124+
Then add the dependency to their `pom.xml`:
125+
126+
```xml
127+
<dependency>
128+
<groupId>com.coveo</groupId>
129+
<artifactId>push-api-client.java</artifactId>
130+
<version><version></version>
131+
</dependency>
132+
```
133+
134+
**Option B — Use system scope (not recommended for production):**
135+
136+
```xml
137+
<dependency>
138+
<groupId>com.coveo</groupId>
139+
<artifactId>push-api-client.java</artifactId>
140+
<version><version></version>
141+
<scope>system</scope>
142+
<systemPath>${project.basedir}/lib/push-api-client.java-<version>.jar</systemPath>
143+
</dependency>
144+
```
145+
146+
**Option C — For Gradle projects:**
147+
148+
Place the JAR in a `libs/` folder and add:
149+
150+
```groovy
151+
dependencies {
152+
implementation files('libs/push-api-client.java-<version>.jar')
153+
}
154+
```
155+
156+
### Running Tests
157+
158+
To run the test suite:
159+
160+
```bash
161+
mvn test
162+
```
163+
164+
### Validating Code Format
165+
166+
Before contributing, ensure your code follows the project's formatting rules:
167+
168+
```bash
169+
mvn spotless:check # Check formatting
170+
mvn spotless:apply # Auto-fix formatting issues
171+
```
172+
68173
## Usage
69174

70175
> See more examples in the `./samples` folder.

0 commit comments

Comments
 (0)