Maven-publish generated pom declares all dependency scopes as <runtime>


(Phanindra) #1

Hi,
I’m trying to use a gradle-built library in a maven project. I ran into cannot find symbol issues and found the following after digging deeper.

The pom file generated by the maven publish marks all transitive dependencies as runtime

<groupId>my.group</groupId>
<artifactId>my-project</artifactId>
<version>development-SNAPSHOT</version>
<dependencies>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.4.1</version>
      <scope>runtime</scope>   <--------
    </dependency>
    <dependency>
      <groupId>my.group</groupId>
      <artifactId>my-transitive-dependency</artifactId>
      <version>development-SNAPSHOT</version>
      <scope>runtime</scope>   <-------
    </dependency>
<dependencies>

And the Maven documentation says

'runtime' scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.

So the maven does not grab transitive dependencies in my case as they are declared runtime .

I found a couple of related posts but without any associated tickets / solutions. It’d be super inconvenient if I had to manually add all the transitive dependencies for every gradle-built library used in a maven project. Could you please let me know how to fix it? I’m using Gradle 2.13.


(Phanindra) #2

Any inputs would be helpful. Thanks.