# Packages don't exist

**URL:** <https://discuss.gradle.org/t/packages-dont-exist/5864>\
**Category:** Old Forum Archive\
**Created:** [October 27, 2014, 5:05pm UTC](https://discuss.gradle.org/t/packages-dont-exist/5864 "2014-10-27T17:05:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefano1](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Stefano1](https://discuss.gradle.org/u/Stefano1)\
**Post date:** [October 27, 2014, 5:05pm UTC](https://discuss.gradle.org/t/packages-dont-exist/5864/1 "2014-10-27T17:05:00Z")

</div>

Hello everybody, I just began to use Gradle and started with a very simple eclipse project. I need to use a couple of libraries, but when I run gradle build I gor the following errors:

```gradle
error: package org.springframework.aop does not exist
error: package org.apache.log4j does not exist

```

here is my build.gradle file:

```gradle
apply plugin: "java"
apply plugin: "maven"
apply plugin: 'eclipse'
  group = "myorg"
version = 1.0
  repositories {
    mavenCentral()
}
  sourceSets.all { set ->
    def jarTask = task("${set.name}Jar", type: Jar) {
        baseName = baseName + "-$set.name"
        from set.output
    }
      artifacts {
        archives jarTask
    }
}
  sourceSets {
    api
    impl
}
  dependencies {
    apiCompile 'commons-codec:commons-codec:1.5'
      implCompile sourceSets.api.output
    implCompile 'commons-lang:commons-lang:2.6'
      testCompile 'junit:junit:4.9'
    testCompile sourceSets.api.output
    testCompile sourceSets.impl.output
    runtime configurations.apiRuntime
    runtime configurations.implRuntime
          compile("org.springframework:spring-aop:4.1.1.RELEASE")
 compile('log4j:log4j:1.2.17')
}
  jar {
    from sourceSets.api.output
    from sourceSets.impl.output
}
  uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri("${buildDir}/repo"))
              addFilter("main") { artifact, file -> artifact.name == project.name }
            ["api", "impl"].each { type ->
                addFilter(type) { artifact, file -> artifact.name.endsWith("-$type") }
                                  // We now have to map our configurations to the correct maven scope for each pom
                ["compile", "runtime"].each { scope ->
                    configuration = configurations[type + scope.capitalize()]
                    ["main", type].each { pomName ->
                        pom(pomName).scopeMappings.addMapping 1, configuration, scope
                    }
                }
            }
          }
    }
}

```

then in a java class I use:

```gradle
import org.springframework.aop.*;
import org.apache.log4j.*

```

which generate the error. Please note that building in eclipse works fine. Any suggestion?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [October 27, 2014, 5:55pm UTC](https://discuss.gradle.org/t/packages-dont-exist/5864/2 "2014-10-27T17:55:00Z")

</div>

Looks like ‘compile’ isn’t being added to ‘apiCompile’ and ‘implCompile’, but needs to be.

---

<div class="post-metadata">

**Author:** ![Stefano1](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Stefano1](https://discuss.gradle.org/u/Stefano1)\
**Post date:** [October 28, 2014, 8:10am UTC](https://discuss.gradle.org/t/packages-dont-exist/5864/3 "2014-10-28T08:10:00Z")

</div>

Hello Peter, thank you for your answer, but i didn’t get it… can you give me more details about your idea? I tried

```gradle
apicompile 'log4j:log4j:1.2.17'

```

but this gives me

```gradle
Could not find method apicompile() for arguments [log4j:log4j:1.2.17] on root project 'AccMan'

```

---

<div class="post-metadata">

**Author:** ![Stefano1](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Stefano1](https://discuss.gradle.org/u/Stefano1)\
**Post date:** [October 28, 2014, 8:25am UTC](https://discuss.gradle.org/t/packages-dont-exist/5864/4 "2014-10-28T08:25:00Z")

</div>

ooops… sorry, it is case sensitive. This configuration solved the problem:

```gradle
apiCompile 'log4j:log4j:1.2.17'
apiCompile 'org.springframework:spring-aop:4.1.1.RELEASE'

```
