title: Build error of app using log4j package using gradle build framework
body: <p>I created a simple java project using gradle, starting with "gradle init --type java-application".</p>
  
  <p>Content of main java file - "App.java":</p>
  
  <pre><code>import org.apache.log4j.Logger;
  import java.io.*;
  import java.sql.SQLException;
  import java.util.*;
  
  
  public class App {
  
      public static void main(String[] args) {
          System.out.println("Howdy");
      }
  }
  </code></pre>
  
  <p>Content of file "build.gradle":</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'application'
  
  repositories {
      jcenter()
  }
  
  dependencies {
      compile 'com.google.guava:guava:21.0'
      testCompile 'junit:junit:4.12'
  
      // Following added by me for log4j
      compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.0'
      compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0'
  
  }
  
  mainClassName = 'App'
  </code></pre>
  
  <p>The log4j jar file seems to have been downloaded successfully by gradle:</p>
  
  <pre><code>/home/ahmed/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.11.0/bede79a3f150711634a3047985517431bf6499f2/log4j-api-2.11.0.jar
  /home/ahmed/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.11.0/e6b751e02120c08702d98750f6a80bc25343b7f5/log4j-core-2.11.0.jar
  </code></pre>
  
  <p>There are a bunch of log4j jar/pom files in ~/.gradle directory.
  When I try to build, I am getting the following build error:</p>
  
  <pre><code>$ gradle build
  :compileJava
  /home/ahmed/temp/javatut/gradle-demo/src/main/java/App.java:5: error: package org.apache.log4j does not exist
  import org.apache.log4j.Logger;
                         ^
  1 error
  :compileJava FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':compileJava'.
  &gt; Compilation failed; see the compiler error output for details.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  
  Total time: 0.808 secs
  </code></pre>
  
  <p>I am new to gradle/java.  Any help would be greatly appreciated.</p>
  
  <p>Thank you,
  Ahmed.</p>