-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot resolve external dependency com.google.googlejavaformat:google-java-format:1.3 #120
Comments
At the top of the error message, it says:
If you add |
Please check my spotless config |
Does your project have subprojects? Your project file as written above works for me. If you have subprojects, you might need a block like this:
|
@nedtwigg thanks for your commitment. I don't use subproject, its just plain vennila gradle java project. To reproduce that clone this repo https://github.com/arulrajnet/gradle-java-template . Then just run |
The code you linked to does not have |
This spoless.gradle file already has that snippet. But adding that snippet in build.gradle solves the problem. Thanks |
Ahhhh. Interesting. I've never quite understood how |
The problem is that spotless takes the This is also the reason why you have to configure the repository for all sub-projects. I personally find this not so intuitive. Normally I would expect that the When applying the new spotless version to Junit, there were similar problems. @nedtwigg If you agree to my proposal (using |
If it's possible, I'm all for it! Another possible answer is to use the buildscript for the root project. I think it's reasonable to have different repositories for the build than for the artifacts being built (this was the usecase which drove #99 in the first place), but it's harder to understand needing different buildscript repos for different projects... |
|
@nedtwigg As you assumed, it is not possible to access the buildscript from which the spotless has been created. I looked at the Gradle code and I am pretty sure that I have not missed anything. |
This makes me a little nervous. It's not uncommon for a company to proxy all access to external repositories, so automatically adding mavenCentral is a fairly promiscuous behavior. One reason for this is to ensure that all artifacts from the public internet have a local proxy, and the second more important reason to proxy is so that every library can be vetted by a security team before it is allowed to be part of the build. The nice thing about the "root project" workaround I mentioned above is that we would never add a repository that the user hasn't already approved. |
As stated before, the solution does not conflict with a proxy. I use Archiva myself, followed the gradle documentation for integration. The drawback with the "root project" is that it does not work for the problem @arulrajnet described. |
So let's take the case where the company proxy only contains deps that have been approved by a security team. Somebody bumps a version number to something which hasn't been approved, but they won't notice because it will get downloaded from mavenCentral(), even though they never once asked that I agree that the
|
To be hones I consider your example a little bit far fetched:
Anyhow, I knew that the proposed solution is controversial. Since in the end you have to answer for the software, you have the final word. The root project solution you proposed initially is definitely a good enhancement and will also make the description how to configure spotless easier. Code-wise it should be a one-liner, since the tests can remain as they are. Rest is documentation. Do you implement it, or shall I? |
I agree with you on 2, but I think 1 isn't that rare - e.g. a CI environment that doesn't have access to the public internet. If you build it, I'd be happy to turn the release crank. |
Sorry Ned, I am unsure now what your final word is.
This is in my opinion how gradle wants a proxy to be configured. |
Sorry - my final word is that I do not want to add If you want to build the rootProject based workaround, then I'll be happy to release it quickly. But by no means are you obligated to build it :) |
@nedtwigg i am running it in multiple project. i have added the
|
Can you point us to your buildscript? You might need |
The same is happening when using example:
|
Recently I have upgraded to spotless 3.4.0. Gradle 3.5 and Java 1.8
My spotless config
I am getting following error.
If I downgrade to 3.0.0 its just working fine for the same config.
EDIT by @nedtwigg: this is a long thread, but the resolution was that the
buildscript
block above must appear inbuild.gradle
, it's not enough for it to be appear in a separate file, such asspotless.gradle
, which getsinclude
d.The text was updated successfully, but these errors were encountered: