Can't resolve dependency(scope=provided) from local maven repository


(Guy Brand) #1

Hi,

it looks like gradle doesn’t resolve dependencies which are stored inside the local maven repository and have the scope set to provided. We have the following setup:

pom of the dependency inside the local maven repository:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
      <groupId>com.test</groupId>
    <artifactId>test</artifactId>
    <version>0.9.0</version>
      <dependencies>
          <dependency>
            <groupId>de.odysseus.juel</groupId>
            <artifactId>juel-impl</artifactId>
            <version>2.2.4</version>
            <exclusions>
                <exclusion>
                    <groupId>de.odysseus.juel</groupId>
                    <artifactId>juel-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
          <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>coyote</artifactId>
            <version>6.0.33</version>
            <scope>provided</scope>
        </dependency>
          <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>jasper</artifactId>
            <version>6.0.33</version>
            <scope>provided</scope>
        </dependency>
      </dependencies>
      <build>
          <plugins>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
          </plugins>
      </build>
  </project>

repositories in gradle

repositories {
      mavenLocal()
      maven {
        url DOWNLOAD_REPO_URL
        credentials {
            username DOWNLOAD_REPO_USERNAME
            password DOWNLOAD_REPO_PASSWORD
        }
    }
}

It can’t resolve the jasper and coyote libraries. Do we make something wrong or is it a problem with gradle and local maven repositories?


(Luke Daley) #2

That’s exactly the contract of ‘provided’; the client provides the dependency. That is, they do not get resolved transitively.


(Guy Brand) #3

Thanks for your quick answer. I didn’t knew that they didn’t get resolved transitively.


(Luke Daley) #4

No probs.