1

I want to start simple project using Spring Boot version 2.0.0.M4 , Maven and JDK 9. I created structure:

enter image description here

In my pom .xml in "app" module I have:

<properties>
    <spring-boot-starter-web.version>2.0.0.M4</spring-boot-starter-web.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${spring-boot-starter-web.version}</version>
    </dependency>
</dependencies>

My module-info.java is simple:

module app {
    requires spring.boot.autoconfigure;
}

And I am trying to run simple server:

package com.resizer.app;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String[] args) {

    }
}

When I am trying to run the server during compilation I get multiple errors:

Error:java: the unnamed module reads package javax.annotation from both tomcat.embed.core and javax.annotation.api
Error:java: the unnamed module reads package javax.annotation.sql from both tomcat.embed.core and javax.annotation.api
Error:java: the unnamed module reads package javax.annotation.security from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot.starter reads package javax.annotation from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot.starter reads package javax.annotation.sql from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot.starter reads package javax.annotation.security from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot reads package javax.annotation from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot reads package javax.annotation.sql from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot reads package javax.annotation.security from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot.starter.logging reads package javax.annotation from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot.starter.logging reads package javax.annotation.sql from both tomcat.embed.core and javax.annotation.api
Error:java: module spring.boot.starter.logging reads package javax.annotation.security from both tomcat.embed.core and javax.annotation.api
Error:java: module logback.classic reads package javax.annotation from both tomcat.embed.core and javax.annotation.api
Error:java: module logback.classic reads package javax.annotation.sql from both tomcat.embed.core and javax.annotation.api

Am I doing something wrong with the module-info? How to prevent this from happening? Should I exclude some dependencies?

Marcin Majewski
  • 1,007
  • 1
  • 15
  • 30

0 Answers0