Giter Site home page Giter Site logo

Comments (11)

johnrengelman avatar johnrengelman commented on September 28, 2024

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.

rburgst avatar rburgst commented on September 28, 2024

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.

rburgst avatar rburgst commented on September 28, 2024

actually here is the correct artifact specification that I used

artifacts {
    shadow(tasks.shadowJar.outputJar) {
        builtBy shadowJar
    }
}

from shadow.

codesimplicity avatar codesimplicity commented on September 28, 2024

I think the simplest solution is this:

artifacts {
    archives(shadowJar.outputJar) {
        builtBy shadowJar
    }
}

Exactly what's mentioned in the Gradle documentation.

from shadow.

johnrengelman avatar johnrengelman commented on September 28, 2024

@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.

mcandre avatar mcandre commented on September 28, 2024

On my machine, gradle complains that the shadowJar task does not have an outputJar property. Was it renamed?

from shadow.

johnrengelman avatar johnrengelman commented on September 28, 2024

Yes...ShadowJarTask extends from the Gradle Jar so you would just reference the task the same way you would a Jar task.

from shadow.

mohamnag avatar mohamnag commented on September 28, 2024

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.

johnrengelman avatar johnrengelman commented on September 28, 2024

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.

mohamnag avatar mohamnag commented on September 28, 2024

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.

johnrengelman avatar johnrengelman commented on September 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.