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 6789823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:39:04+00:00 2026-05-26T17:39:04+00:00

I have a Gradle build script, with mixed Maven dependencies (I use Maven Central

  • 0

I have a Gradle build script, with mixed Maven dependencies (I use Maven Central for dependencies resolution) and a local directory. The snippet is this:

repositories {
    mavenCentral()

    flatDir name: 'directoryRepository', dirs: 'tools/libs'
}

Then I need to declare my local dependencies this way:

dependencies {
    compile ":commons-cli:1.0@jar"
}

I cannot use the files(‘…’) notation (because other parts of the script would fail with a class cast exception from Array to HashMap, and I cannot change that part).

The jar files are added to the build path correctly. The problem is that Gradle wants to fetch, for every jar in the ‘tools/libs’, another ‘-source’ jar.
Indeed, if I have in the tools/libs folder:

commons-cli-1.0.jar
commons-cli-1.0-sources.jar

all works fine. If I remove the source jar, it gives the error “unable to resolve dependency”, poiting out the -source jar.

I have more then 50 files to be managed this way, and of course I haven’t the source jars (nor I’m interested to have).

How can I exclude the source jar fetching?

Many thanks in advance for any hints.

Fabio Da Soghe

  • 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-05-26T17:39:05+00:00Added an answer on May 26, 2026 at 5:39 pm

    If you are using IDEA there’s a module-wide setting ideaModule.downloadSources = false which can help, but it will disable all source downloading for IDEA.

    Not sure what you meant by files(...) notation, but how about trying this?:

    dependencies{
      ...
      compile fileTree( dir: "toos/lib", include: '*.jar' )
      ... or ...
      compile fileTree( dir: "toos/lib", includes: ['*.jar'] )
    }
    

    Edit:

    There appears to be an associated bug report, fixed in milestone 5. Giving it a try revealed that the error is still there but now it’s just a warning and the build will succeed. Apparently the warning is coming from Ivy so there is no easy fix for it 🙁

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Gradle script (version 0.8), I have a local ivy repository which I
I have a jar dependency for the build.gradle file itself. I'm using this definition:
I have a gradle build script similar to: apply plugin: 'war' task genSources <<
It works with ear file we build with Maven. Using Gradle, I have an
What can cause a org.gradle.api.internal.artifacts.ivyservice.ModuleVersionNotFoundException for maven dependencies installed (manually) in local repository? In
we use Gradle for building Java projects and at the moment we have Ivy
I've recently started using Gradle and replacing my existing Maven-based projects. I have had
Is there a way to build custom test phases in gradle? I have a
How is the order of the doFirst method determined in a gradle build script?
The situation I want to integrate a gradle script to specify the dependencies for

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.