When creating a Roo project with the “project” command, we have the option to specify the Java Version
$ roo roo> project --topLevelPackage com.gordondickens.myproj --java 6 --projectName testapp
If we choose Java 7 with Roo 1.2.1, the code will not compile with AspectJ included.
Steps to change to Java 7:
- Change the Java version to 1.7
- Set the AspectJ version to 1.7.0.M1 or higher
- Set the Maven AspectJ Plugin to 1.4 or higher
- If using Hypersonic, change the version to 2.2.8 or higher
- Change the Hibernate version to 4.1.2 or higher
- (optional) Change the Hibernate Entity Manager to 4.1.2 or higher
<properties>
<aspectj.version>1.7.0.M1</aspectj.version>
<java.version>1.7</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<roo.version>1.2.1.RELEASE</roo.version>
<slf4j.version>1.6.4</slf4j.version>
<spring.version>3.1.1.RELEASE</spring.version>
</properties>
...
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.1.2</version>
<exclusions>
<exclusion>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</exclusion>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</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>
</aspectLibraries>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
...
Since Roo doesn’t support Java 7 features (ROO-3106), what is the advantage of Configuring Spring Roo for Java 7?