I am failing to use shadow to create a shadow jar,...
# community-support
k
I am failing to use shadow to create a shadow jar, I think because the plugin isn't found in various repositories. If I try to build shadow, it fails because gradle can't find com.gradle.enterprise Do you know an alternative for minimizing a jar file? Or, if I can find the jar files for shadow, can I use them without trying to resolve them in a repository?
maven central lists the artifact as being hosted from jfrog where it doesn't exist.
t
k
Yup. The result is gradle can't find the plugin.
t
What's the exact/full error message? And what configuration do you have?
k
Gradle Core Plugins (plugin is not in 'org.gradle' namespace) Plugin Repositories (could not resolve plugin artifact 'com.github.johnrengelman.shadowcom.github.johnrengleman.shadow.gradle.plugin8.1.1') Searched in the following repositories: Gradle Central Plugin Repository
I suppose it's related to my work
t
Just did a
gradle init
for a "basic" build (build structure only), added the following to the
build.gradle.kts
Copy code
plugins {
  id("com.github.johnrengelman.shadow") version "8.1.1"
}
then ran `./gradlew buildEnvironment`:
Copy code
$ ./gradlew buildEnvironment


> Task :buildEnvironment

------------------------------------------------------------
Root project 'test'
------------------------------------------------------------

classpath
+--- com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1
|    \--- com.github.johnrengelman:shadow:8.1.1
|         +--- org.jdom:jdom2:2.0.6.1
|         +--- org.ow2.asm:asm:9.4
|         +--- org.ow2.asm:asm-commons:9.4
|         |    +--- org.ow2.asm:asm:9.4
|         |    \--- org.ow2.asm:asm-tree:9.4
|         |         \--- org.ow2.asm:asm:9.4
|         +--- commons-io:commons-io:2.11.0
|         +--- org.apache.ant:ant:1.10.13
|         |    \--- org.apache.ant:ant-launcher:1.10.13
|         +--- org.codehaus.plexus:plexus-utils:3.5.1
|         +--- org.apache.logging.log4j:log4j-core:2.20.0
|         |    \--- org.apache.logging.log4j:log4j-api:2.20.0
|         \--- org.vafer:jdependency:2.8.0
\--- org.apache.logging.log4j:log4j-core:{require 2.17.1; reject [2.0, 2.17.1)} -> 2.20.0 (c)

(c) - A dependency constraint, not a dependency. The dependency affected by the constraint occurs elsewhere in the tree.
(*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation.

A web-based, searchable dependency report is available by adding the --scan option.
So probably related to your environment yes.
k
I see jars on my home computer at: https://plugins.gradle.org/m2/com/github/johnrengelman/shadow/8.1.1/ But only poms at work.
I see the maven shade plugin is not blocked though. I wonder if there is a way to include maven only for the shade plugin, after gradle
t
Maybe using
pluginManagement
in the settings script with repository content filtering? https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:repository-content-filtering (but I think you won't have the latest version; and Maven Central apparently only has a fork by Palantir)
v
It is not Maven Central that says it has the shadow plugin 8.1.1. It is mvnrepository.com which displays it which is not Maven Central but indexes several other repositories. It says some other repository has that version which does not work though, while it does not say that plugin central has it where it works. So it seems you (currently) cannot trust mvnrepository.com.
That the plugins are not found in plugin central must be something on your computer or on your infrastructure as it works fine everywhere else. Maybe you need to use a proxy you didn't configure, or you have some firewall, antivirus, or similar interfering, ...