Import not working

Hello

I got a problem using gradle here is my config:

$ gradle -version

------------------------------------------------------------ Gradle 2.0 ------------------------------------------------------------

Build time:

2014-07-01 07:45:34 UTC Build number: none Revision:

b6ead6fa452dfdadec484059191eb641d817226c

Groovy:

2.3.3 Ant:

Apache Ant™ version 1.9.3 compiled on December 23 2013 JVM:

1.7.0_55 (Oracle Corporation 24.51-b03) OS:

Linux 3.13.0-32-generic amd64

$ cat build.gradle

apply plugin: ‘java’ apply plugin:‘application’

repositories {

mavenCentral() }

dependencies {

compile ‘org.apache.logging.log4j:log4j-core:2.0.1’

compile ‘de.sciss:jsyntaxpane:1.0.0’

compile ‘org.jdom:jdom:2.0.2’ }

And I get typical errors like these:

/home/sieben/Dropbox/workspace/upstream/contiki/tools/cooja/src/main/java/org/contikios/cooja/plugins/ScriptRunner.java:79: error: package org.apache.log4j does not exist import org.apache.log4j.Logger;

^ /home/sieben/Dropbox/workspace/upstream/contiki/tools/cooja/src/main/java/org/contikios/cooja/plugins/ScriptRunner.java:80: error: package org.jdom does not exist import org.jdom.Element;

It’s probably a silly mistake but I don’t know why it doesn’t work.

It looks to me like you want to use classes from log4j 1.x but you have a dependency on log4j 2.0.1 in your build script. Have a look here for api changes between log4j 1.x and 2.0: http://logging.apache.org/log4j/2.x/manual/migration.html

The same goes for jdom 2.0.2, it looks like the package changed for the Element class and is now org.jdom2.Element.

Thank you very much :smiley: Everything works fine now.