Skip to content

Add examples for Maven project into README #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ jobs:
- name: Prepare next dev version
id: prepare_next_dev
run: |
# gradle
sed -i -e 's/${{ needs.version.outputs.CURRENT_VERSION }}/${{ needs.version.outputs.NEXT_VERSION }}/g' gradle.properties
sed -i -E -e 's/json-schema-validator((-[a-z]+)?:|\/)[0-9]+\.[0-9]+\.[0-9]+/json-schema-validator\1${{ needs.version.outputs.RELEASE_VERSION }}/g' README.md
sed -i -E -e 's/json-schema-validator((-[a-z]+)?:|\/)[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)/json-schema-validator\1${{ needs.version.outputs.NEXT_VERSION }}/g' README.md
# maven
sed -i -e -e 's|<version>[0-9]+\.[0-9]+\.[0-9]+|<version>${{ needs.version.outputs.RELEASE_VERSION }}|g' README.md
sed -i -e -e 's|<version>[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)|<version>${{ needs.version.outputs.NEXT_VERSION }}|g' README.md
- name: Commit next dev version
id: commit_next_dev
uses: EndBug/add-and-commit@v9
Expand Down
77 changes: 71 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ from [kotlinx.serialization-json](https://github.com/Kotlin/kotlinx.serializatio

In order to use releases add Maven Central repository to the list of repositories.

##### Kotlin
##### Gradle

###### Kotlin

```kotlin
repositories {
Expand All @@ -50,7 +52,7 @@ repositories {
implementation("io.github.optimumcode:json-schema-validator:0.5.1")
```

##### Groovy
###### Groovy

```groovy
repositories {
Expand All @@ -68,27 +70,60 @@ implementation("io.github.optimumcode:json-schema-validator")
_Release are published to Sonatype repository. The synchronization with Maven Central takes time._
_If you want to use the release right after the publication you should add Sonatype Release repository to your build script._

##### Kotlin
###### Kotlin

```kotlin
repositories {
maven(url = "https://s01.oss.sonatype.org/content/repositories/releases/")
}
```

##### Groovy
###### Groovy

```groovy
repositories {
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' }
}
```

##### Maven

You can also use `json-schema-validator` as a dependency in your maven project.
But Maven cannot use Gradle's metadata so you need to depend on a JVM-specific artifact in your project:

```xml
<dependency>
<groupId>io.github.optimumcode</groupId>
<artifactId>json-schema-validator-jvm</artifactId>
<version>0.5.1</version>
</dependency>
```

And you can also add a sonatype repository to your POM file

```xml
<repositories>
<repository>
<id>sonatype-release</id>
<name>sonatype-release</name>
<url>https://s01.oss.sonatype.org/content/repositories/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
```

#### Snapshots

_If you want to use SNAPSHOT version you should add Sonatype Snapshot repository to your build script._

##### Kotlin
##### Gradle

###### Kotlin

```kotlin
repositories {
Expand All @@ -103,7 +138,7 @@ implementation(platform("io.github.optimumcode:json-schema-validator-bom:0.5.2-S
implementation("io.github.optimumcode:json-schema-validator")
```

##### Groovy
###### Groovy

```groovy
repositories {
Expand All @@ -113,6 +148,36 @@ repositories {
implementation 'io.github.optimumcode:json-schema-validator:0.5.2-SNAPSHOT'
```

##### Maven

For the Maven you need to add a snapshot repository to your POM file

```xml
<repositories>
<repository>
<id>sonatype</id>
<name>sonatype-snapshot</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
```

And then you can add a dependency to a SNAPSHOT version

```xml
<dependency>
<groupId>io.github.optimumcode</groupId>
<artifactId>json-schema-validator-jvm</artifactId>
<version>0.5.2-SNAPSHOT</version>
</dependency>
```

### Example

If you have just one JSON schema or many independent schemes
Expand Down
Loading