Gradle dependency downloads but packages aren't available in project

I have a small jar that shades in some code it needs when it’s run. However this jar also has an API that other apps can use so I wanted to publish it to a maven repo.

However I’ve discovered that when I publish the shaded jar, my projects that use this lib can’t find any of the packages inside. Yet when I publish the unshaded jar, it works fine.

The task I use to publish the shaded jar:

publishing {
    publications {
        shadow(MavenPublication) { publication ->
            project.shadow.component(publication)
        }
    }

    repositories {
        maven {
            name = 'repsy'
            url = 'https://repo.repsy.io/mvn/viveleroi/tileowner'
            credentials(PasswordCredentials)
        }
    }
}

The task I use for the unshaded jar:

publishing {
    publications {
        maven(MavenPublication) {
            groupId = 'network.darkhelmet'
            artifactId = 'tileowner'
            version = '1.0.0'

            from components.java
        }
    }

    repositories {
        maven {
            name = 'repsy'
            url = 'https://repo.repsy.io/mvn/viveleroi/tileowner'
            credentials(PasswordCredentials)
        }
    }
}

The project using this lib as a dependency uses:

maven { url = 'https://repo.repsy.io/mvn/viveleroi/tileowner' }

compileOnly 'network.darkhelmet:tileowner:1.0.0'

When the shaded jar was published, gradle appears to find the JAR and lists it in the dep tree, yet can’t find any packages in it. I personally downloaded the jar and unzipped it, and all files are present. IntelliJ also does not list it in the “external libraries” list.

When the unshaded jar is published, gradle can find the packages, IntelliJ lists it in the “external libraries” list, and everything compiles fine.

So I have two questions:

a) I don’t understand why one works but not the other.

b) How can I shade my jar for distrubtion, but not shade it for the publication? When I try with a shadowJar task enabled, but the second publishing task above, it says it can’t find the jar.