Skip to content
Open
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
51 changes: 46 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The Maven Central repository is enabled by default for Maven users.
* exposed-money - extensions to support MonetaryAmount from "javax.money:money-api"
* exposed-spring-boot-starter - a starter for [Spring Boot](https://spring.io/projects/spring-boot) to utilize Exposed as the ORM instead
of [Hibernate](https://hibernate.org/)
* exposed-version-catalog - provides a [Gradle Version Catalog](https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog) for Exposed modules

```xml

Expand Down Expand Up @@ -128,6 +129,11 @@ The Maven Central repository is enabled by default for Maven users.
<artifactId>exposed-spring-boot-starter</artifactId>
<version>1.0.0-beta-2</version>
</dependency>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-version-catalog</artifactId>
<version>1.0.0-beta-2</version>
</dependency>
</dependencies>

```
Expand All @@ -140,16 +146,17 @@ dependencies {
implementation 'org.jetbrains.exposed:exposed-crypt:1.0.0-beta-2'
implementation 'org.jetbrains.exposed:exposed-dao:1.0.0-beta-2'
implementation 'org.jetbrains.exposed:exposed-jdbc:1.0.0-beta-2'

implementation 'org.jetbrains.exposed:exposed-jodatime:1.0.0-beta-2'
// or
implementation 'org.jetbrains.exposed:exposed-java-time:1.0.0-beta-2'
// or
implementation 'org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0-beta-2'

implementation 'org.jetbrains.exposed:exposed-json:1.0.0-beta-2'
implementation 'org.jetbrains.exposed:exposed-money:1.0.0-beta-2'
implementation 'org.jetbrains.exposed:exposed-spring-boot-starter:1.0.0-beta-2'
implementation 'org.jetbrains.exposed:exposed-version-catalog:1.0.0-beta-2'
}
```

Expand All @@ -164,16 +171,17 @@ dependencies {
implementation("org.jetbrains.exposed:exposed-crypt:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")

implementation("org.jetbrains.exposed:exposed-jodatime:$exposedVersion")
// or
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
// or
implementation("org.jetbrains.exposed:exposed-kotlin-datetime:$exposedVersion")

implementation("org.jetbrains.exposed:exposed-json:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-money:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-spring-boot-starter:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-version-catalog:$exposedVersion")
}
```

Expand All @@ -183,6 +191,39 @@ and in `gradle.properties`
exposedVersion=1.0.0-beta-2
```

#### Using Version Catalog

Alternatively, you can use the Exposed Version Catalog to manage dependencies:

In `settings.gradle.kts`:

```kotlin
dependencyResolutionManagement {
versionCatalogs {
create("exposed") {
from("org.jetbrains.exposed:exposed-version-catalog:1.0.0-beta-2")
}
}
}
```

In `build.gradle.kts`:

```kotlin
dependencies {
implementation(exposed.core)
implementation(exposed.dao)
implementation(exposed.jdbc)

// For modules with hyphens in their names, use dot notation
implementation(exposed.kotlin.datetime)
implementation(exposed.java.time)
implementation(exposed.spring.boot.starter)
}
```

This approach provides type-safe accessors for all Exposed modules and ensures version consistency.

## Samples

Check out the [samples](samples/README.md) for a quick start.
Expand Down Expand Up @@ -310,7 +351,7 @@ fun main() {
}

println("Manual join:")

(Users innerJoin Cities)
.select(Users.name, Cities.name)
.where {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ repositories {
}

allprojects {
if (this.name != "exposed-tests" && this.name != "exposed-bom" && this.name != "exposed-r2dbc-tests" && this != rootProject) {
if (this.name != "exposed-tests" && this.name != "exposed-bom" && this.name != "exposed-r2dbc-tests" && this.name != "exposed-version-catalog" && this != rootProject) {
configurePublishing()
}
}

apiValidation {
ignoredProjects.addAll(listOf("exposed-tests", "exposed-bom", "exposed-r2dbc-tests"))
ignoredProjects.addAll(listOf("exposed-tests", "exposed-bom", "exposed-r2dbc-tests", "exposed-version-catalog"))
}

subprojects {
Expand Down
65 changes: 65 additions & 0 deletions exposed-version-catalog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Exposed Version Catalog

This module provides a [Gradle Version Catalog](https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog) for Exposed modules.

## Usage

### In settings.gradle.kts

Add the following to your `settings.gradle.kts` file:

```kotlin
dependencyResolutionManagement {
versionCatalogs {
create("exposed") {
from("org.jetbrains.exposed:exposed-version-catalog:<version>")
}
}
}
```

Replace `<version>` with the version of Exposed you want to use.

### In build.gradle.kts

You can then use the version catalog in your `build.gradle.kts` file:

```kotlin
dependencies {
implementation(exposed.core)
implementation(exposed.dao)
implementation(exposed.jdbc)

// For modules with hyphens in their names, use dot notation
implementation(exposed.kotlin.datetime)
implementation(exposed.java.time)
implementation(exposed.spring.boot.starter)
}
```

## Available Dependencies

The version catalog includes all Exposed modules:

- `exposed.core` - Core module with SQL DSL
- `exposed.dao` - DAO API implementation
- `exposed.jdbc` - JDBC transport implementation
- `exposed.kotlin.datetime` - Kotlin DateTime extensions
- `exposed.java.time` - Java Time extensions
- `exposed.jodatime` - JodaTime extensions
- `exposed.json` - JSON data type extensions
- `exposed.money` - MonetaryAmount extensions
- `exposed.crypt` - Encrypted data type extensions
- `exposed.migration` - Database migration support
- `exposed.r2dbc` - R2DBC reactive implementation
- `exposed.spring.boot.starter` - Spring Boot integration
- `spring.transaction` - Spring transaction support

## Benefits

Using the version catalog provides several benefits:

1. **Type-safe accessors** - You get type-safe accessors for all Exposed modules
2. **Version consistency** - All modules use the same version
3. **Simplified dependency management** - No need to specify group and version for each dependency
4. **IDE support** - Better IDE support with code completion
98 changes: 98 additions & 0 deletions exposed-version-catalog/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
plugins {
`version-catalog`
`maven-publish`
signing
}

group = "org.jetbrains.exposed"

catalog {
versionCatalog {
create("exposed") {
rootProject.subprojects.filter {
it.name != "exposed-version-catalog" &&
it.name != "exposed-tests" &&
it.name != "exposed-r2dbc-tests" &&
it.name != "exposed-bom"
}.forEach { project ->
val moduleName = project.name.removePrefix("exposed-")
val nameParts = moduleName.split("-")
val accessorName = if (nameParts.size > 1) {
nameParts.joinToString(".") { it }
} else {
moduleName
}

val version: String by rootProject
val artifactId = project.name
library(accessorName, "org.jetbrains.exposed:$artifactId:$version")
}
}
}
}

publishing {
val version: String by rootProject

publications {
create<MavenPublication>("versionCatalog") {
groupId = "org.jetbrains.exposed"
artifactId = project.name
this.version = version
from(components["versionCatalog"])

pom {
name.set("Exposed Version Catalog")
description.set("Version Catalog for Exposed modules")
url.set("https://github.com/JetBrains/Exposed")

licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}

developers {
developer {
id.set("JetBrains")
name.set("JetBrains Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}

scm {
url.set("https://github.com/JetBrains/Exposed")
connection.set("scm:git:git://github.com/JetBrains/Exposed.git")
}
}
}
}

val publishingUsername: String? = System.getenv("PUBLISHING_USERNAME")
val publishingPassword: String? = System.getenv("PUBLISHING_PASSWORD")

repositories {
maven {
name = "Exposed"
url = uri("https://maven.pkg.jetbrains.space/public/p/exposed/release")
credentials {
username = publishingUsername
password = publishingPassword
}
}
}
}

// Sign publications if signing key is present
val signingKey: String? = System.getenv("SIGN_KEY_PRIVATE")
val signingKeyPassphrase: String? = System.getenv("SIGN_KEY_PASSPHRASE")

if (signingKey != null && signingKeyPassphrase != null) {
signing {
useInMemoryPgpKeys(signingKey, signingKeyPassphrase)
sign(publishing.publications["versionCatalog"])
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include("exposed-json")
include("exposed-migration")
include("exposed-r2dbc")
include("exposed-r2dbc-tests")
include("exposed-version-catalog")

pluginManagement {
repositories {
Expand Down