Skip to content
This repository was archived by the owner on May 12, 2024. It is now read-only.

Commit 8f77bf1

Browse files
committed
Added maven central publishing
1 parent 418f361 commit 8f77bf1

4 files changed

Lines changed: 113 additions & 21 deletions

File tree

README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If you just want to downgrade .jar files you can check out the [Usage (Standalon
1616
If you want the executable jar file you can download a stable release from [GitHub](https://github.com/RaphiMC/JavaDowngrader/releases/latest) or the latest dev version from this [Jenkins](https://build.lenni0451.net/job/JavaDowngrader/).
1717

1818
### Gradle/Maven
19-
To use JavaDowngrader with Gradle/Maven you can use this [Maven server](https://maven.lenni0451.net/#/releases/net/raphimc/JavaDowngrader) or [Jitpack](https://jitpack.io/#RaphiMC/JavaDowngrader).
19+
To use JavaDowngrader with Gradle/Maven you can get it from [Maven central](https://mvnrepository.com/artifact/net.raphimc.javadowngrader), [Lenni0451's maven](https://maven.lenni0451.net/#/releases/net/raphimc/javadowngrader) or [Jitpack](https://jitpack.io/#RaphiMC/JavaDowngrader).
2020
You can also find instructions how to implement it into your build script there.
2121

2222
## Usage (Standalone/Bootstrap)
@@ -39,19 +39,13 @@ As a low level class modification framework in your application [ClassTransform]
3939
JavaDowngrader provides the ``impl-classtransform`` submodule which contains various utility classes for ClassTransform.
4040

4141
## Usage (In Gradle)
42-
To use JavaDowngrader in gradle (To downgrade a whole jar or one of your source sets) you have to add the following to the top of your build.gradle:
43-
```groovy
44-
buildscript {
45-
repositories {
46-
maven {
47-
name = "Lenni0451 Releases"
48-
url "https://maven.lenni0451.net/releases"
49-
}
50-
}
42+
To use JavaDowngrader in Gradle you can get it from [Lenni0451's maven](https://maven.lenni0451.net/#/releases/net/raphimc/javadowngrader).
43+
You can also find instructions how to implement it into your build script there.
5144

52-
dependencies {
53-
classpath "net.raphimc.javadowngrader:gradle-plugin:1.0.0"
54-
}
45+
After adding the repository to your gradle project you can apply the plugin like this:
46+
```groovy
47+
plugins {
48+
id "net.raphimc.java-downgrader" version "1.1.1-SNAPSHOT"
5549
}
5650
```
5751

build.gradle

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,40 @@ allprojects {
4343
repositories {
4444
maven {
4545
name = "reposilite"
46-
url = project.maven_version.endsWith("SNAPSHOT") ? "https://maven.lenni0451.net/snapshots" : "https://maven.lenni0451.net/releases"
46+
url = "https://maven.lenni0451.net/" + (project.maven_version.endsWith("SNAPSHOT") ? "snapshots" : "releases")
4747

4848
credentials(PasswordCredentials)
4949
authentication {
5050
basic(BasicAuthentication)
5151
}
5252
}
5353
}
54+
}
55+
56+
signing {
57+
setRequired(false)
58+
sign configurations.archives
59+
}
60+
61+
project.tasks.withType(PublishToMavenRepository).forEach {
62+
it.dependsOn(project.tasks.withType(Sign))
63+
}
64+
}
65+
66+
configure(allprojects.findAll { it.name != "gradle-plugin" }) {
67+
publishing {
68+
repositories {
69+
maven {
70+
name = "ossrh"
71+
url = "https://s01.oss.sonatype.org/" + (project.maven_version.endsWith("SNAPSHOT") ? "content/repositories/snapshots/" : "service/local/staging/deploy/maven2/")
72+
73+
credentials(PasswordCredentials)
74+
authentication {
75+
basic(BasicAuthentication)
76+
}
77+
}
78+
}
79+
5480
publications {
5581
maven(MavenPublication) {
5682
groupId = project.maven_group
@@ -85,14 +111,8 @@ allprojects {
85111
}
86112

87113
signing {
88-
setRequired(false)
89-
sign configurations.archives
90114
sign publishing.publications.maven
91115
}
92-
93-
project.tasks.withType(PublishToMavenRepository).forEach {
94-
it.dependsOn(project.tasks.withType(Sign))
95-
}
96116
}
97117

98118
dependencies {

gradle-plugin/build.gradle

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
1+
apply plugin: "java-gradle-plugin"
2+
13
dependencies {
4+
compileOnly gradleApi()
5+
26
api project(":impl-classtransform")
7+
}
38

4-
compileOnly gradleApi()
9+
gradlePlugin {
10+
website = "https://github.com/RaphiMC/JavaDowngrader"
11+
vcsUrl = "https://github.com/RaphiMC/JavaDowngrader"
12+
plugins {
13+
javadowngrader {
14+
id = "net.raphimc.java-downgrader"
15+
implementationClass = "net.raphimc.javadowngrader.gradle.JavaDowngraderPlugin"
16+
displayName = "JavaDowngrader"
17+
description = "Standalone program and library which can downgrade Java classes/programs down to Java 8"
18+
tags.addAll("class downgrade", "class modification", "java downgrade")
19+
}
20+
}
21+
}
22+
23+
publishing {
24+
publications {
25+
pluginMaven(MavenPublication) {
26+
pom {
27+
name = "JavaDowngrader"
28+
description = "Standalone program and library which can downgrade Java classes/programs down to Java 8"
29+
url = "https://github.com/RaphiMC/JavaDowngrader"
30+
licenses {
31+
license {
32+
name = "LGPL-3.0 License"
33+
url = "https://github.com/RaphiMC/JavaDowngrader/blob/main/LICENSE"
34+
}
35+
}
36+
developers {
37+
developer {
38+
id = "RK_01"
39+
}
40+
}
41+
scm {
42+
connection = "scm:git:git://github.com/RaphiMC/JavaDowngrader.git"
43+
developerConnection = "scm:git:ssh://github.com/RaphiMC/JavaDowngrader.git"
44+
url = "https://github.com/RaphiMC/JavaDowngrader.git"
45+
}
46+
}
47+
}
48+
}
49+
}
50+
51+
signing {
52+
sign publishing.publications.pluginMaven
553
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* This file is part of JavaDowngrader - https://github.com/RaphiMC/JavaDowngrader
3+
* Copyright (C) 2023 RK_01/RaphiMC and contributors
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation; either
8+
* version 3 of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
package net.raphimc.javadowngrader.gradle;
19+
20+
import org.gradle.api.Plugin;
21+
import org.gradle.api.Project;
22+
import org.jetbrains.annotations.NotNull;
23+
24+
public class JavaDowngraderPlugin implements Plugin<Project> {
25+
26+
@Override
27+
public void apply(@NotNull Project project) {
28+
}
29+
30+
}

0 commit comments

Comments
 (0)