title: IntelliJ IDEA 13 + Gradle + Spring-data-neo4j + Aspectj Configuration
body: <p>Most of the configurations that I have seen for using Gradle + Spring-data-neo4j + Aspectj have been either for Eclipse and/or using Maven. I can't seen to find a complete setup to get to work properly.</p>
  
  <p>Here's is my build.gradle:</p>
  
  <pre><code>apply plugin:'base'
  apply plugin:'java'
  apply plugin:'idea'
  
  buildscript {
      repositories {
          maven {
              url "https://maven.eveoh.nl/content/repositories/releases"
          }
      }
      dependencies {
          classpath "nl.eveoh:gradle-aspectj:1.4"
      }
  }
  
  repositories {
      maven {
          url "http://m2.neo4j.org/content/repositories/releases/"
      }
      mavenCentral()
      mavenLocal()
  }
  
  project.ext {
      springVersion = "4.0.3.RELEASE"
      neo4jVersion = "2.0.1.RELEASE"
      springDataGraphVersion = "3.0.1.RELEASE"
      aspectjVersion = "1.7.4"
  
      sourceCompatibility = 1.7
      targetCompatibility = 1.7
  }
  
  apply plugin: 'aspectj'
  
  compileAspect {
      xlint = 'warning'
  }
  
  dependencies {
      compile 'org.slf4j:slf4j-api:1.7.6'
  
      compile "org.springframework:spring-context:${springVersion}"
      compile "org.neo4j:neo4j:${neo4jVersion}"
      // Provides Repository based Object &lt;-&gt; Graph Mapping
      compile "javax.validation:validation-api:1.0.0.GA"
      compile "org.springframework.data:spring-data-neo4j-aspects:${springDataGraphVersion}"
      compile 'javax.persistence:persistence-api:1.0-rev-1'
  
  
      testCompile 'junit:junit-dep:4.11'
      testCompile "org.springframework:spring-test:${springVersion}"
      testCompile 'org.hamcrest:hamcrest-all:1.3'
      // Access to Neo4j testing facilities: TestGraphDatabaseFactory
      testCompile "org.neo4j:neo4j-kernel:${neo4jVersion}:tests@jar"
      testRuntime 'org.slf4j:slf4j-simple:1.7.5'
  
      //aspectj dependencies
      aspectpath "org.aspectj:aspectjtools:${aspectjVersion}"
      compile "org.aspectj:aspectjrt:${aspectjVersion}"
      aspectpath group: "org.springframework.data", name: "spring-data-neo4j", version: springDataGraphVersion
  }
  
  configurations {
      runtime
      compileJava
      testCompileJava
  }
  
  // Generate wrapper for Gradle
  task wrapper(type: Wrapper) {
      gradleVersion = '1.11'
  }
  </code></pre>
  
  <p>The <a href="http://docs.spring.io/spring-data/data-neo4j/docs/current/reference/html/tutorial_about-tutorial.html" rel="nofollow">current documentation</a> doesn't seem to have the Aspectj gradle information in it. I used the info from the <a href="http://docs.spring.io/spring-data/data-neo4j/docs/2.3.5.RELEASE/reference/html/setup.html" rel="nofollow">2.3.5.RELEASE</a> which I've merged into this build. I have also set ajc for the compiler but I still think something is missing since that is old. Also, I am NOT using pom.xml but the Java configuration file which is below.</p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackages = "domains")
  @EnableNeo4jRepositories(basePackages = "repos")
  //@EnableSpringConfigured
  @EnableTransactionManagement
  public class AppConfigTest extends Neo4jAspectConfiguration {
  
      public AppConfigTest () {
          setBasePackage("domains");
      }
  
      @Bean (destroyMethod = "shutdown")
      public GraphDatabaseService graphDatabaseService() {
          return new TestGraphDatabaseFactory().newImpermanentDatabase();
      }
  
  }
  </code></pre>
  
  <p><strong>==============[EDIT 1]=================</strong></p>
  
  <p>Updated Gradle build file above using the project <a href="https://github.com/eveoh/gradle-aspectj" rel="nofollow">eveoh/gradle-aspectj</a> as noted by @StefanArmbruster below. However, now I get this error: </p>
  
  <pre><code>* Where:
  Build file 'build.gradle' line: 52
  &gt; Could not find method aspectpath() for arguments [org.aspectj:aspectjtools:1.7.4] on root project
  </code></pre>
  
  <p><strong>==============[EDIT 2]=================</strong></p>
  
  <p>Updated Gradle build fixing the issue above for the moment but now I have this issue:</p>
  
  <pre><code>10:44:10 AM: Executing external task 'build'...
  :processResources UP-TO-DATE
  :compileAspect FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':compileAspect'.
  &gt; Error creating temporary file
  
  * 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: 42.556 secs
  Permission denied
  10:44:53 AM: External task execution finished 'build'.
  </code></pre>