Trying to get a simple example to work
Hello
I'm trying to get spring-data-neo4j to work, but aspectj doesnt work it seems.
Did this:
- Made fresh empty simple maven project.
- Converted to AspectJ project.
- Added this POM (as described in documentation):
Code:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>simple-maven-spring-data-neo4j-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Test1</name>
<description>Trying to get SDN to work in a simple Maven project</description>
<repositories>
<repository>
<id>spring-maven-milestone</id>
<name>Springframework Maven Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.0.0.RC1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.12</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.2</version>
<dependencies>
<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.12</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.12</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
<aspectLibrary>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
</aspectLibrary>
</aspectLibraries>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Now there is an error in the documentation (http://static.springsource.org/sprin.../html/#d0e2885). In the plugin section there is a reference to spring-datastore-neo4j. There is no such thing - its "spring-data-neo4j". Also, why use 1.2 of the aspectj-maven-plugin when there is a 1.4?
- I then made a simple entity:
Code:
package org.test.simplemaven;
import org.springframework.data.neo4j.annotation.NodeEntity;
@NodeEntity
public class TestEntity {
private String blah;
}
- and something to run it:
Code:
package org.test.simplemaven;
public class App {
public static void main(String args) {
TestEntity te = new TestEntity();
te.persist();
}
}
Now both STS and a "mvn clean compile" complains that there is no such thing as persist().
Here is the error:
Code:
[INFO] 1error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.539s
[INFO] Finished at: Tue Nov 15 21:37:05 CET 2011
[INFO] Final Memory: 10M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project simple-maven-spring-data-neo4j-test: Compilation failure
[ERROR] /workspace/simple-maven-spring-data-neo4j-test/src/main/java/org/test/simplemaven/App.java:[6,4] cannot find symbol
[ERROR] symbol : method persist()
[ERROR] location: class org.test.simplemaven.TestEntity
Whats up?