I have a Java project with some dependencies which is in Maven repo.
My project does not have any java files. That make gradle say; I don’t need to download the dependencies.
I can understand that but it is a problem when the Eclipse/Idea plugin is in used as well.
Because the classpath files contains stuff that has not been download. And that leads to errors.
Is there a way there I can force gradle to download the dependencies?
There are some ways of solving this, for instance with a copy task. Maybe explaining a bit more about your Java project without Java files, could help to work out a solution that will work for your context
You may want the
--refresh-dependencies command line option, which is documented here in the user manual. That should force the dependencies to be downloaded.
--refresh-dependencies also does NOT download any dependencies if there is now source files.
Which IDE and which Gradle version?
When importing inside an IDE, or generating IDE configuration files, Gradle configurations like
runtimeClasspath should be resolved, regardless of the existence of Java files.
And this should trigger proper fetching of dependencies if required, that is not cached already.
IDE = Eclipse
Gradle version = 5.2.1
And there is no Buildship
So I assume this means you use the
eclipse plugin to generate the configuration files.
This plugin should trigger the resolution of standard configurations like
runtimeClasspath and their test equivalents. There is no way it could otherwise give a location for a dependency jar without downloading it.
Can you describe in more details what you do, what you change and what does not work?
Yes I use the Eclipse plugin.
When I run the eclipse task then dependencies are resolved and downloaded, to my local cache.
Now this project gets committed to a SCM. Dependencies are NOT committed to SCM.
Someone else checks out the project and run gradle build. Because there is not source files dependencies does not get downloaded.
I generate a lot of projects that has source code.
These projects all have the same dependencies. So to make it easy to maintain they all have a single dependency to a project with no source code but only dependencies that all the other projects needs.
Projects: A1, A2, A3, A4, … all depends on project B. Project B depends on junit, log4j, commons-X, etc.