4

In a project of mine I have a dependency on a java matrix library MTJ which I specify like this in build.gradle:

dependencies {
  ...
  compile 'com.googlecode.matrix-toolkits-java:mtj:1.0.4'
  ...
}

MTJ in turns depends on netlib, more concretely it would be the equivalent of explicitly adding compile 'com.github.fommil.netlib:all:1.1.2' above.

When I run the gradle build. I get the following error:

Could not expand ZIP '/Users/valentin/.gradle/caches/modules-2/files-2.1/com.github.fommil.netlib/all/1.1.2/f235011206ac009adad2d6607f222649aba5ca9e/all-1.1.2.pom'. 
archive is not a ZIP archive.

So somehow gradle is confused and treats the file as been a zip file when it is just a pom that points to other dependencies.

Anyone has a fix or knows of a workaround?

Opal
  • 81,889
  • 28
  • 189
  • 210
Valentin Ruano
  • 2,726
  • 19
  • 29

1 Answers1

3

Please have a look here. The dependency you specified is of type pom - this type in maven is used to aggregate projects. Gradle downloads it, tries to unzip and fails. It seems that this is not what you're looking for. Here you can find other artifacts for group: com.github.fommil.netlib. Please find a jar you're looking for and specify the dependency directly.

Opal
  • 81,889
  • 28
  • 189
  • 210
  • 1
    Thanks! the problem is that I don't import netlib directly but indirectly via mtj... do you think this is a bug in mtj dependencies definition or a limitation/bug in gradle? – Valentin Ruano Sep 03 '15 at 12:22
  • Is there a way I can include dependencies in gradle without triggering recursive dependency inclusion? – Valentin Ruano Sep 03 '15 at 12:31
  • You can exclude a single dependency or a group of them. Then add the netlib dependency separately. Have a look at this section: https://docs.gradle.org/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies – Opal Sep 03 '15 at 12:41
  • Yup I've just noticed that ```transitive = true|false```. That might just be enough. Thanks a lot. – Valentin Ruano Sep 03 '15 at 12:44