ProxioDev / ValioBungee

Synchronize players data between BungeeCord / Velocity proxies
Eclipse Public License 1.0
191 stars 50 forks source link

JitPack Builds Does Not Relocate jedis #96

Closed Simonsator closed 2 months ago

Simonsator commented 2 months ago

intended behavior

The Jitpacks build should have the same jedis class paths, as the builds downloaded by the user from GitHub

what the behavior you actually saw

The jitpack builds do not relocate jedis to com.imaginarycode.minecraft.redisbungee.internal.jedis, meaning plugins compiled against the Jitpack builds (e.g. plugins build using maven or gradle), will use redis.clients.jedis as the class path. This means during runtime the plugins won't run, as the class path for jedis is wrong.

Steps to reproduce

Create a new plugin which is build using Maven/Gradle and use Jitpack for the dependencies. Use any RedisBungee method, which returns something related to Jedis, e.g. RedisBungeeApi.requestJedis() in that plugin. Compile the plugin and then try to run it.

Velocity or Bungeecord Versions

RedisBungee-API, RedisBungee-Velocity and RedisBungee-Bungee have this problem

RedisBungee Version & Redis Version

RedisBungee Version: 0.12.1

Other

I noticed this bug because I wanted to make my Plugin use UnifiedJedis, so that users don't have to enable compatibility mode in the RedisBungee config. What is the preferred way for plugins to receive a UnifiedJedis connection? My plugin uses the Jedis connection of to store its own data in Redis. I am currently planing to use RedisBungeePluginInstance.proxyDataManager().unifiedJedis()

Also, could you clarify the Error message "JedisPool compatibility mode is disabled", so it instead says something like "JedisPool compatibility mode is disabled. Please enable it in the RedisBungee config.yml". This would help users find out how to fix their RedisBungee depending plugins.

ham1255 commented 2 months ago

hmm weird its included in jitpack jars at least https://jitpack.io/com/github/proxiodev/redisbungee/0.12.1/build.log com/github/proxiodev/redisbungee/RedisBungee-Velocity/0.12.1/RedisBungee-Velocity-0.12.1-all.jar

did you add the classifer?

noted: Please enable it in the RedisBungee config.yml Please enable it in the RedisBungee config.yml

ham1255 commented 2 months ago

relevant docs https://github.com/ProxioDev/RedisBungee/wiki/API#redisbungee-java-api in-case you forgot to setup the classifier

ham1255 commented 2 months ago

https://github.com/ProxioDev/RedisBungee/commit/7029552c023af0df5ef8efe6c02aeb509db35887

Simonsator commented 2 months ago

relevant docs https://github.com/ProxioDev/RedisBungee/wiki/API#redisbungee-java-api in-case you forgot to setup the classifier

Thanks for the headsup. I did not read the complete documentation as I should have. It seems like RedisBungee-Commands is not hosted on jitpack. I get Failed to read artifact descriptor for com.github.ProxioDev:RedisBungee-Commands:jar:0.12.1: The following artifacts could not be resolved: com.github.ProxioDev:RedisBungee-Commands:pom:0.12.1 (absent): Could not transfer artifact com.github.ProxioDev:RedisBungee-Commands:pom:0.12.1 from/to jitpack.io (https://jitpack.io): status code: 401, reason phrase: Unauthorized (401), unless I add `

com.github.ProxioDev RedisBungee-Commands
            <exclusion>
                <groupId>co.aikar</groupId>
                <artifactId>acf-bungee</artifactId>
            </exclusion>
        </exclusions>` to the dependency
ham1255 commented 2 months ago

Why is it trying to load it? Its implemention not an api as set in kts file

Simonsator commented 2 months ago

I don't know. This happens if I use the dependency as described in https://github.com/ProxioDev/RedisBungee/wiki/API#for-bungeecord--waterfall with the all classifier.

This happens even with an empty project which only includes the RedisBungee dependency ` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>org.example</groupId>
<artifactId>Test</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
jitpack.io https://jitpack.io
<dependencies>
    <dependency>
        <groupId>com.github.proxiodev.redisbungee</groupId>
        <artifactId>RedisBungee-Bungee</artifactId>
        <version>0.12.1</version>
        <scope>provided</scope>
        <classifier>all</classifier>
    </dependency>
</dependencies>

`

[ERROR] Failed to execute goal on project Test: Could not resolve dependencies for project org.example:Test:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.github.proxiodev.redisbungee:RedisBungee-Bungee:jar:all:0.12.1 -> com.github.ProxioDev:RedisBungee-Commands:jar:0.12.1: Failed to read artifact descriptor for com.github.ProxioDev:RedisBungee-Commands:jar:0.12.1: The following artifacts could not be resolved: com.github.ProxioDev:RedisBungee-Commands:pom:0.12.1 (absent): Could not transfer artifact com.github.ProxioDev:RedisBungee-Commands:pom:0.12.1 from/to jitpack.io (https://jitpack.io): status code: 401, reason phrase: Unauthorized (401) -> [Help 1]

ham1255 commented 2 months ago

i have published a tag that includes commands module 0.12.2

BingYanchi commented 2 months ago

i have published a tag that includes commands module 0.12.2

Unresolved dependency: 'co.aikar:acf-core:jar:0.5.1-SNAPSHOT'
Unresolved dependency: 'co.aikar:acf-velocity:jar:0.5.1-SNAPSHOT'
co.aikar:acf-velocity:jar:0.5.1-SNAPSHOT was not found in https://jitpack.io during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of jitpack.io has elapsed or updates are forced
ham1255 commented 2 months ago

..... these depends shouldn't be included

ham1255 commented 2 months ago

i have redone module structure to fix this depends disaster.

https://jitpack.io/#ProxioDev/redisbungee/0.12.3-SNAPSHOT1

so each project who wish to access Jedis from RedisBungee will need relocation

example


plugins {
    java
    id("com.github.johnrengelman.shadow") version "8.1.1"

}

group = "org.example1"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven {
        name = "sonatype"
        url = uri("https://oss.sonatype.org/content/groups/public/")
    }
    maven {
        name = "papermc-repo"
        url = uri("https://repo.papermc.io/repository/maven-public/")
    }
    maven {
        url = uri("https://jitpack.io")
    }
}

dependencies {
    compileOnly("io.github.waterfallmc:waterfall-api:1.20-R0.1-SNAPSHOT")
    compileOnly("com.github.ProxioDev.redisbungee:RedisBungee-Bungee:71287055b4")
}

tasks {
    compileJava {
        options.encoding = Charsets.UTF_8.name()
        options.release.set(17)
    }
    shadowJar {
        relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis")
        relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil")
    }
}

i will send maven version later.

wiki has to be updated

Simonsator commented 2 months ago

As far as I can see this solution does not allow developers to access com.imaginarycode.minecraft.redisbungee.RedisBungee.

I use this com.imaginarycode.minecraft.redisbungee.RedisBungee to access the ProxyDataManager to access unifiedJedis(). Is there a better way to receive the UnifiedJedis instance created by RedisBungee?

ham1255 commented 2 months ago

As far as I can see this solution does not allow developers to access com.imaginarycode.minecraft.redisbungee.RedisBungee.

I use this com.imaginarycode.minecraft.redisbungee.RedisBungee to access the ProxyDataManager to access unifiedJedis(). Is there a better way to receive the UnifiedJedis instance created by RedisBungee?

UnifiedJedis jedis = RedisBungeeAPI.getRedisBungeeApi().getSummoner().obtainResource();;

i am currently in process to write the relocation section

ham1255 commented 2 months ago

com.imaginarycode.minecraft.redisbungee.RedisBungee

tbh as it should be anyways since its internal or anyways you can just get plugin instance from the proxy and cast it into RedisBungeePlugin<ProxiedPlayer> incase of Bungeecord

ham1255 commented 2 months ago

wiki has been updated