Skip to content

Commit 99e331e

Browse files
committed
Add: configure Maven publishing for GitHub Packages in build.gradle.kts
1 parent 85b5a03 commit 99e331e

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

build.gradle.kts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id("java")
33
application
44
id("org.openjfx.javafxplugin") version "0.0.13"
5+
id("maven-publish") // Plugin pour la publication
56
}
67

78
group = "fr.sandro642.github"
@@ -18,7 +19,6 @@ dependencies {
1819
implementation("io.projectreactor:reactor-core:3.6.9")
1920
implementation("org.springframework.boot:spring-boot-starter-webflux:3.2.2")
2021

21-
// JavaFX (nécessaire si jamais le plugin ne les ajoute pas automatiquement)
2222
implementation("org.openjfx:javafx-controls:21")
2323
implementation("org.openjfx:javafx-fxml:21")
2424
}
@@ -29,14 +29,13 @@ javafx {
2929
}
3030

3131
application {
32-
mainClass.set("fr.sandro642.github.ConnectorAPI") // ta classe principale JavaFX
32+
mainClass.set("fr.sandro642.github.ConnectorAPI")
3333
}
3434

3535
tasks.jar {
3636
manifest {
3737
attributes["Main-Class"] = "fr.sandro642.github.ConnectorAPI"
3838
}
39-
// Inclure les dépendances dans le JAR (optionnel si tu veux un "fat JAR")
4039
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
4140
from({
4241
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
@@ -45,4 +44,25 @@ tasks.jar {
4544

4645
tasks.test {
4746
useJUnitPlatform()
47+
}
48+
49+
publishing {
50+
repositories {
51+
maven {
52+
name = "GitHubPackages"
53+
url = uri("https://maven.pkg.github.com/sandro642/ConnectorAPI") // Remplacez par votre OWNER/REPO
54+
credentials {
55+
username = System.getenv("USERNAME")
56+
password = System.getenv("TOKEN")
57+
}
58+
}
59+
}
60+
publications {
61+
register<MavenPublication>("mavenJava") {
62+
from(components["java"])
63+
groupId = project.group.toString()
64+
artifactId = "ConnectorAPI"
65+
version = project.version.toString()
66+
}
67+
}
4868
}

0 commit comments

Comments
 (0)