"Could not resolve" is not a useful error message

With the following build:

apply plugin: 'java'
apply plugin: 'idea'

repositories {
    jcenter()
}

dependencies {
    compile 'net.posick:mdnsjava:2.2.0'
}

Running:

gradle idea

The output I get is:

:ideaModule
Could not resolve: net.posick:mdnsjava:2.2.0
:ideaProject
:ideaWorkspace
:idea

BUILD SUCCESSFUL

I’ll ignore the “build successful” lie, as it has already been mentioned elsewhere and seemingly nobody was interested in fixing it, but the “Could not resolve” error is not particularly helpful because it doesn’t describe the problem, giving me absolutely nothing to go on unless I want to read the debug logs.

The way it is now, I read “Could not resolve” as “Did not resolve”, which is to say, Gradle is doing something wrong, until it can provide evidence to the contrary.

Ignoring again your repetitive bad attitude in this forum seeking for help, I don’t understand what you want Gradle to do here? I tries to resolve the dependency and stated that it can’t. I think this is good enough as a default output.

Running your build again with -i (info logging) provides you with the information you’re looking for. You would have seen that Gradle tries to resolve the parent pom of net.posick:mdnsjava:2.2.0 but can’t find it at https://jcenter.bintray.com/net/posick/mdnsjava-full/2.2.0/mdnsjava-full-2.2.0.pom thats why the artifact couldn’t be resolved. Without this parent pom there’s no way to resolve this maven dependency.

In general I think its better to continue for Gradle in this case and generate idea project files without the missing artifacts instead of just breaking the build here.

What Gradle actually stated was that it couldn’t resolve the dependency “mdnsjava”.

When I actually went to the artifact server manually, I found the dependency there, and say, “well, I was able to resolve it, so I guess Gradle just sucks.” Which, IMO, is an accurate evaluation of the situation.

If the actual problem was with some other dependency, the error message should mention that dependency, not some other one which is fine.

Basically, unhelpful error messages are unhelpful. We shouldn’t have to run with extra logging enabled and comb through more output to figure out the underlying cause for an exception. That’s the build tool’s job. The build tool should do its job, and stop wasting time I should be spending trying to do mine.

And if you think my attitude is repeatedly bad, maybe it’s because I’m forced to use a build tool which wastes more time getting in the way of my work than any amount of time which it could theoretically have saved, had only it worked correctly.

We’re also in disagreement about the failure handling for the idea task. It would be far better for failures to be proper failures, rather than generating an incorrect result. If the problem is you thinking that generating an incorrect result is better, then I don’t know how you can fix that problem.

I can totally empathize - nobody should be treated like you’ve been. Unfortunately, much too often, good people are forced by the powers that be to use crappy tools.

Your effort is wasted on this forum. Regarding your work situation - I can only suggest that you quit your job and go somewhere where they can really appreciate the value you bring.

2 Likes

What do you suggest javac or maven ?

The suggestion is just to report the file with the actual issue, so that when the error message is seen, there is enough information to act upon.