Comments (11)
I would suggest creating a new configuration and assigning the output of the shadow task as it's artifact. Then when you declare the project dependency you can specify that you want this configuration instead of the default.
Something like (untested, check the Gradle documentation: http://www.gradle.org/docs/current/userguide/artifact_management.html)
configurations {
shadow
}
artifacts {
shadow(tasks.shadow.shadowJar) {
builtBy tasks.shadow
}
}
and then in the project dependencies:
dependencies {
compile project(path: ":myproject", configuration: "shadow")
}
from shadow.
This is exactly what I ended up doing (after a few hours googling). I think it would be useful for others as well to include this in the readme.
thanks
from shadow.
actually here is the correct artifact specification that I used
artifacts {
shadow(tasks.shadowJar.outputJar) {
builtBy shadowJar
}
}
from shadow.
I think the simplest solution is this:
artifacts {
archives(shadowJar.outputJar) {
builtBy shadowJar
}
}
Exactly what's mentioned in the Gradle documentation.
from shadow.
@codesimplicity i think you'll run into an issue with that because the normal jar
artifact will be attached to that as well, so you would likely have to set the classifier
property on the archive.
artifacts {
archives(shadowJar.outputJar) {
classifier 'shadow'
builtBy shadowJar
}
}
from shadow.
On my machine, gradle complains that the shadowJar task does not have an outputJar
property. Was it renamed?
from shadow.
Yes...ShadowJarTask
extends from the Gradle Jar
so you would just reference the task the same way you would a Jar
task.
from shadow.
I have actually a similar problem and tried the following in build file:
artifacts {
archives(shadowJar.outputJar) {
builtBy shadowJar
}
}
using the most recent version of the plugin I get the following error:
Could not get unknown property 'outputJar' for task ':shadowJar' of type com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar.
PS: I'm actually trying to publish the shadowJar alongside the normal JAR.
from shadow.
The code above is 2 years old and since then shadow was refactor to more closely resemble a standard jar task. Please look at the Gradle docs for the Jar task to see th correct property name. Or look at the User Guide which is linked to in the readme for this project. There are ezamoles of configuring publishing in there.
from shadow.
Ok, I did the following:
artifacts {
archives sourcesJar
archives javadocJar
archives shadowJar
}
but now I get the following error:
Could not transfer artifact com.group:name:jar:shadow-classifier:1.0-20160725.192618-22 from/to remote (http://mym2.reop/repository/maven-snapshots): Broken pipe
from shadow.
You're gonna have to dig into it. The examples in the User Guide are part of test cases a verified. Anything beyond that is beyond my control.
If you find a specific issue or are able to create a new, minimal project that exhibits this problem, please open a new ticket.
from shadow.
Related Issues (20)
- Resources file in META-INF folder - conflict between shadded and not-shadded files.
- Plugin is incompatible with isolated projects feature HOT 2
- Future home/support for Shadow? HOT 20
- Gigantic jar when using Gradle 8.x HOT 4
- Unsupported class file major version 65 HOT 7
- Add a getter on ShadowCopyAction.ArchiveFileTreeElement to access the containing jar file name HOT 2
- How can i upgrade the jackson-databin jar version that included in the shade jar htrace-core4 HOT 2
- ShadowJar will report ZipException but not actually fail the build, creating invalid artifacts. HOT 1
- Relocating packages is also changing properties HOT 2
- Can't understand Expression 'shadowJar' HOT 1
- shadow plugin ignores jar files in resource folder
- Can't use the same module name as archive file name for the jar file HOT 2
- Create shadow jar after remapping HOT 1
- Exclude dependencies specified in libs-file?
- Gradle Warning: CopyProcessingSpec.setFileMode(Integer) method has been deprecated HOT 1
- Documentation says `destinationDir` which has been changed for `destinationDirectory` HOT 1
- NettyChannelBuilder can't locate the name resolver provider from service files when build with minimize shadowJar
- FileTreeElement.getMode()-deprecation notice HOT 2
- Redirect the old Maven coordinate to the new one HOT 2
- Old shadow versions are unreachable HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shadow.