I am starting a new maven project that should run with Spring Boot (in case that's relevant), and it compiled fine. But then, I decided to start using Java9-modules. So, I had eclipse generate the module-info.java
file that looks like this:
module BirdTreeModel {
exports mjl.familytree.birdtree;
requires junit;
requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.boot.test;
requires spring.test;
}
This causes a compile error, however. Eclipse says: "Syntax error on token "module", interface expected"
.
(And when I do a Maven clean install, it says "Compilation failure: ...module not found: junit"
and same for modules spring.boot.test
and spring.test
).
echo %JAVA_HOME% gives C:\Program Files\Java\jdk-12
mvn -version
gives:
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:1
4+02:00)
Maven home: `D:\Programming practice\maven\apache-maven-3.5.4\bin\..`
Java version: 12, vendor: Oracle Corporation, runtime: `C:\Program Files\Java\jdk-12`
Default locale: `en_US`, platform encoding: `Cp1252`.
OS name: "Windows 7", version: "6.1", arch: "AMD64", family: "Windows"
The run configurations of the Maven build of the project are also on JDK-12
My pom
looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>mjl.familytree</groupId>
<artifactId>birdtree-model-dao</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>birdtree-model-dao</name>
<description>My family tree program</description>
<repositories>
<repository>
<id>repository.spring.release</id>
<name>Spring GA Repository</name>
<url>http://repo.spring.io/release</url>
</repository>
</repositories>
<properties>
<maven.compiler.source>1.12</maven.compiler.source>
<maven.compiler.target>1.12</maven.compiler.target>
<maven.compiler.release>12</maven.compiler.release>
<java.version>12</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>