slimjar icon indicating copy to clipboard operation
slimjar copied to clipboard

Cannot resolve GSON

Open Lorenzo0111 opened this issue 3 years ago • 11 comments

SlimJar always gives errors about gson download.

Stacktrace

Lorenzo0111 avatar Oct 30 '21 17:10 Lorenzo0111

This is likely due to MirrorSelector removing central, The simplest solution atm would be to provide a MirrorSelector implementation that does not remove Central. (https://github.com/slimjar/slimjar/blob/master/slimjar/src/main/java/io/github/slimjar/app/builder/ApplicationBuilder.java#L293)

As a lambda it should just be

(a, b) -> a

Vshnv avatar Oct 30 '21 17:10 Vshnv

still getting the same error

Lorenzo0111 avatar Oct 31 '21 13:10 Lorenzo0111

Kindly provide your slimjar.json file from your jar

Vshnv avatar Nov 02 '21 18:11 Vshnv

slimjar.zip

Lorenzo0111 avatar Nov 05 '21 17:11 Lorenzo0111

it because the internal repository which is https://repo.vshnv.tech/ down and slimjar tries to get com.google.code.gson:gson:2.8.6 from the repository. here

the actual solution is that changing the internal repository like that;

.internalRepositories(Collections.singleton(new Repository(new URL(SimpleMirrorSelector.ALT_CENTRAL_URL))));

portlek avatar Nov 07 '21 14:11 portlek

Still not working with the same error

Lorenzo0111 avatar Nov 08 '21 16:11 Lorenzo0111

Still not working with the same error

maybe you can try what i did in my own branch SimpleMirrorSelector.DEFAULT_CENTRAL_MIRROR_URL -> SimpleMirrorSelector.ALT_CENTRAL_URL

portlek avatar Nov 08 '21 16:11 portlek

Done. But I still get the same error

Lorenzo0111 avatar Nov 11 '21 18:11 Lorenzo0111

did you run ./gradlew publishToMavenLocal command? because the own branch is working on my projects.

portlek avatar Nov 11 '21 19:11 portlek

Found the issue: https://github.com/slimjar/slimjar/blob/master/slimjar/src/main/java/io/github/slimjar/resolver/reader/facade/ReflectiveGsonFacadeFactory.java#L81 https://github.com/slimjar/slimjar/blob/master/slimjar/src/main/java/io/github/slimjar/relocation/facade/ReflectiveJarRelocatorFacadeFactory.java#L127

The default mirror selector is still active here hence it switches central to repo.vshnv.tech again

Vshnv avatar Nov 11 '21 19:11 Vshnv

Fixed by editing this line.

Lorenzo0111 avatar Nov 14 '21 15:11 Lorenzo0111