Hi all-

I am trying to get a spike going w/ Spring Data Graph and Neo4J. SDG
uses AspectJ under the covers to enhance your persistent POJO's.
Pretty much all of the existing samples for SDG are Maven-centric, and
being the maverick that I am I am trying to use the Gradle AspectJ
plugin.

Here's the build.gradle:
=================

apply plugin: 'java'
apply plugin: 'idea'
apply from: 
'https://github.com/breskeby/gradleplugins/raw/0.9-upgrade/aspectjPlugin/aspectJ.gradle'

repositories {
  mavenCentral()
  mavenRepo urls: 'http://maven.springframework.org/milestone'
  mavenRepo urls: 'http://maven.springframework.org/release'
  mavenRepo urls: 'http://maven.springframework.org/snapshot'
  mavenRepo urls: 'http://m2.neo4j.org'
  mavenRepo urls: 'http://repository.jboss.com/maven2/'
}

dependencies {
  ajc 'org.aspectj:aspectjtools:1.6.11.RELEASE'
  compile 'org.springframework.data:spring-data-neo4j:1.0.0.RELEASE',
          'org.aspectj:aspectjrt:1.6.11.RELEASE'
}

ideaProject {
  javaVersion = '1.6'
}

Here are the classes I'm trying to compile:
===============================

package org.stjude.sprdatagraphspike;

import org.springframework.data.graph.annotation.NodeEntity;
import org.springframework.data.graph.annotation.RelatedTo;
import org.springframework.data.graph.core.Direction;
import org.springframework.data.graph.neo4j.annotation.Indexed;

import java.util.Set;

@NodeEntity
public class Person {

    @Indexed
    private String name;

    @RelatedTo(direction = Direction.BOTH, elementClass = Person.class)
    private Set<Person> friends;

    public Person() {}
    public Person(String name) {
        this.name = name;
    }

    private void knows(Person friend) { friends.add(friend); }
}

package org.stjude.sprdatagraphspike;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpikeApp {

    public static void main(String[] args) {
        ApplicationContext context = new
ClassPathXmlApplicationContext("application-context.xml");

        Person jon = new Person("Jon").persist();
    }
}

**** Note that the elementClass property of @RelatedTo will only
accept the type Class<? extends NodeBacked>. The application of
@NodeEntity to this class is supposed to add the NodeBacked interface
via AspectJ. It also adds the missing "persist" method that I'm
referencing in SpikeApp.main.

Here's the output from gradle build:
=========================

[~/Projects/spr-data-graph-spike] ➔ gradle build
:processResources
:compileJava
[ant:iajc] 
/Users/mstine/Projects/spr-data-graph-spike/src/main/java/org/stjude/sprdatagraphspike/Person.java:16
[error] Type mismatch: cannot convert from Class<Person> to Class<?
extends NodeBacked>
[ant:iajc] @RelatedTo(direction = Direction.BOTH, elementClass = Person.class)
[ant:iajc]                                                       ^^^^^^^
[ant:iajc] 
/Users/mstine/Projects/spr-data-graph-spike/src/main/java/org/stjude/sprdatagraphspike/SpikeApp.java:18
[error] The method persist() is undefined for the type Person
[ant:iajc] Person jon = new Person("Jon").persist();
[ant:iajc]
[ant:iajc]
[ant:iajc] 2 errors

FAILURE: Build failed with an exception.

**** As you can see, all of the things that I said are "supposed to
happen" aren't. Now I am able to get this to compile by using the
AspectJ compiler directly inside of IntelliJ. Interestingly enough,
when I generate Eclipse project files and pull this into SpringSource
Tool Suite, it doesn't seem to get the AspectJ stuff right and balks
at the same things the ajc compiler is balking at in Gradle.

At any rate, has anyone had success with this or something similar?
I've done very little w/ AspectJ directly, so I'm not sure where to
go.

Thanks!

-- 
Matt Stine
Deep South Software: Training, Consulting, Coaching
http://www.deepsouthsoftware.com
[email protected]

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to