Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8183095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:03:32+00:00 2026-06-07T01:03:32+00:00

I am new to gradle but learning quickly. I need to get some specific

  • 0

I am new to gradle but learning quickly. I need to get some specific JARs from logback into a new directory in my release task. The dependencies are resolving OK, but I can’t figure out how, in the release task, to extract just logback-core-1.0.6.jar and logback-access-1.0.6.jar into a directory called ‘lib/ext’. Here are the relevant excerpts from my build.gradle.

dependencies {
    ...
    compile 'org.slf4j:slf4j-api:1.6.4'
    compile 'ch.qos.logback:logback-core:1.0.6'
    compile 'ch.qos.logback:logback-classic:1.0.6'
    runtime 'ch.qos.logback:logback-access:1.0.6'
    ...
}
...
task release(type: Tar, dependsOn: war) {
    extension = "tar.gz"
    classifier = project.classifier
    compression = Compression.GZIP

    into('lib') {
        from configurations.release.files
        from configurations.providedCompile.files
    }

    into('lib/ext') {
        // TODO:  Right here I want to extract just logback-core-1.0.6.jar and logback-access-1.0.6.jar
    }
    ...
}

How do I iterated over the dependencies to locate those specific files and drop them in the lib/ext directory created by into(‘lib/ext’)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:03:34+00:00Added an answer on June 7, 2026 at 1:03 am

    Configurations are just (lazy) collections. You can iterate over them, filter them, etc. Note that you typically only want to do this in the execution phase of the build, not in the configuration phase. The code below achieves this by using the lazy FileCollection.filter() method. Another approach would have been to pass a closure to the Tar.from() method.

    task release(type: Tar, dependsOn: war) {
        ...
        into('lib/ext') {
            from findJar('logback-core') 
            from findJar('logback-access')
        }
    }
    
    def findJar(prefix) { 
        configurations.runtime.filter { it.name.startsWith(prefix) }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Gradle, and I am trying to use my very-own-and-beauty doclet
I'm new to gradle. I can see something like project.getPlugins() . what does this
New to PHP and MySQL, have heard amazing things about this website from Leo
New developer here,Im using the Custom Image Picker by ray wenderlich. But what I
I need to get the data for each row in an advanceddatagrid where the
Hello to all that read I am self learning C++ from a text book.
I recently did a migration upgrade from TFS2005 to TFS2010. Everything works, but the
Disclaimer: I'm fairly new with Gradle. I'm trying to build my project with Gradle
Please i need you help my script. I'm generating a new column, whereby a
I'm here not with a question of specific coding, but more of a query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.