我尝试将我开始开发的没有模块的Spring Boot项目迁移到Java 9 Jigsaw架构。
我无法理解为什么(我尝试了很多解决方案并在这个问题上花了几个小时)但是在构建我的服务模块时,这取决于我的通用模块, common 的类不可访问。
注意:我的所有module-info.java
文件都位于每个模块的src/main/java
文件夹下。
提前谢谢,我不知道我的配置有什么问题......
以下是我尝试对项目的根文件夹mvn clean install
进行操作时得到的结果:
[INFO] 54 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] server 0.0.1-SNAPSHOT .............................. SUCCESS [ 2.449 s]
[INFO] common ............................................. SUCCESS [ 4.242 s]
[INFO] service ............................................ FAILURE [ 3.058 s]
[INFO] api 0.0.1-SNAPSHOT ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.602 s
[INFO] Finished at: 2018-03-25T18:40:01+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project service: Compilation failure: Compilation failure:
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[3,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[13,103] cannot find symbol
[ERROR] symbol: class LovedTrackDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[3,48] package com.lastfm.playlists.server.common.utils does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[4,48] package com.lastfm.playlists.server.common.utils does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[19,12] cannot find symbol
[ERROR] symbol: class LovedTrackDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.common.LastfmApiTrackDto_to_LovedTrackDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[22,17] cannot find symbol
[ERROR] symbol: class Pair
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.ConverterFactory
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/LastfmService.java:[3,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/LastfmService.java:[4,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/LastfmService.java:[31,16] cannot find symbol
[ERROR] symbol: class LovedTracksDto
[ERROR] location: class com.lastfm.playlists.server.service.api.LastfmService
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/LastfmService.java:[37,21] cannot find symbol
[ERROR] symbol: class TagDto
[ERROR] location: class com.lastfm.playlists.server.service.api.LastfmService
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiImageDtoList_to_ImageDtoList_Converter.java:[3,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiImageDtoList_to_ImageDtoList_Converter.java:[15,117] cannot find symbol
[ERROR] symbol: class ImageDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiImageDtoList_to_ImageDtoList_Converter.java:[21,17] cannot find symbol
[ERROR] symbol: class ImageDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.common.LastfmApiImageDtoList_to_ImageDtoList_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[3,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[4,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[19,139] cannot find symbol
[ERROR] symbol: class LovedTracksDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[25,12] cannot find symbol
[ERROR] symbol: class LovedTracksDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.lovedtracks.LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[47,18] cannot find symbol
[ERROR] symbol: class LovedTrackDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.lovedtracks.LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/toptags/LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter.java:[3,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/toptags/LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter.java:[17,142] cannot find symbol
[ERROR] symbol: class TagDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/toptags/LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter.java:[24,17] cannot find symbol
[ERROR] symbol: class TagDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.toptags.LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTagDto_to_TagDto_Converter.java:[3,55] package com.lastfm.playlists.server.common.model.lastfm does not exist
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTagDto_to_TagDto_Converter.java:[10,93] cannot find symbol
[ERROR] symbol: class TagDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTagDto_to_TagDto_Converter.java:[17,12] cannot find symbol
[ERROR] symbol: class TagDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.common.LastfmApiTagDto_to_TagDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[20,16] cannot find symbol
[ERROR] symbol: variable LovedTrackDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.common.LastfmApiTrackDto_to_LovedTrackDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[21,22] cannot find symbol
[ERROR] symbol: method getMbid()
[ERROR] location: variable t of type com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiTrackDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[22,46] cannot find symbol
[ERROR] symbol: method getArtist()
[ERROR] location: variable t of type com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiTrackDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[22,64] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getName()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiArtistDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[23,25] cannot find symbol
[ERROR] symbol: method getName()
[ERROR] location: variable t of type com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiTrackDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[24,49] cannot find symbol
[ERROR] symbol: method getDate()
[ERROR] location: variable t of type com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiTrackDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTrackDto_to_LovedTrackDto_Converter.java:[25,51] cannot find symbol
[ERROR] symbol: method getImage()
[ERROR] location: variable t of type com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiTrackDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[30,34] cannot find symbol
[ERROR] symbol: variable ClassUtil
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.ConverterFactory
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[45,70] cannot find symbol
[ERROR] symbol: class Pair
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.ConverterFactory
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[62,34] cannot find symbol
[ERROR] symbol: variable ClassUtil
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.ConverterFactory
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/ConverterFactory.java:[68,40] cannot find symbol
[ERROR] symbol: class Pair
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.ConverterFactory
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiImageDtoList_to_ImageDtoList_Converter.java:[25,27] cannot find symbol
[ERROR] symbol: variable ImageDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.common.LastfmApiImageDtoList_to_ImageDtoList_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiImageDtoList_to_ImageDtoList_Converter.java:[26,35] cannot find symbol
[ERROR] symbol: method getText()
[ERROR] location: variable i of type com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiImageDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiImageDtoList_to_ImageDtoList_Converter.java:[27,36] cannot find symbol
[ERROR] symbol: method getSize()
[ERROR] location: variable i of type com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiImageDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[26,9] cannot find symbol
[ERROR] symbol: class LovedTracksDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.lovedtracks.LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[26,50] cannot find symbol
[ERROR] symbol: class LovedTracksDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.lovedtracks.LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[34,22] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getLovedtracks()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiUserGetLovedTracksResponseDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[35,22] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getAttr()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiLovedTracksDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[36,22] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getTotal()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiLovedTracksAttributesDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[42,22] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getLovedtracks()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiUserGetLovedTracksResponseDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[43,22] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getTrack()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.user.lovedtracks.LastfmApiLovedTracksDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/lovedtracks/LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter.java:[50,45] cannot find symbol
[ERROR] symbol: class LovedTrackDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.lovedtracks.LastfmApiLovedTracksResponseDto_to_LovedTracksDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/toptags/LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter.java:[25,108] cannot find symbol
[ERROR] symbol: method getToptags()
[ERROR] location: variable lastfmApiTrackGetTopTagsResponseDto of type com.lastfm.playlists.server.service.api.lastfm.model.track.toptags.LastfmApiTrackGetTopTagsResponseDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/toptags/LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter.java:[26,22] invalid method reference
[ERROR] cannot find symbol
[ERROR] symbol: method getTag()
[ERROR] location: class com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiTopTagsDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/toptags/LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter.java:[29,48] cannot find symbol
[ERROR] symbol: class TagDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.toptags.LastfmApiTrackGetTopTagsResponseDto_to_TagDtoList_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTagDto_to_TagDto_Converter.java:[19,16] cannot find symbol
[ERROR] symbol: variable TagDto
[ERROR] location: class com.lastfm.playlists.server.service.api.converter.lastfm.common.LastfmApiTagDto_to_TagDto_Converter
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTagDto_to_TagDto_Converter.java:[20,42] cannot find symbol
[ERROR] symbol: method getName()
[ERROR] location: variable lastfmApiTagDto of type com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiTagDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiTagDto_to_TagDto_Converter.java:[21,41] cannot find symbol
[ERROR] symbol: method getUrl()
[ERROR] location: variable lastfmApiTagDto of type com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiTagDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiDateDto_to_Date_Converter.java:[32,40] cannot find symbol
[ERROR] symbol: method getText()
[ERROR] location: variable date of type com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiDateDto
[ERROR] /D:/lastfm-playlists-workspace/lastfm-playlists-server/service/src/main/java/com/lastfm/playlists/server/service/api/converter/lastfm/common/LastfmApiDateDto_to_Date_Converter.java:[34,69] cannot find symbol
[ERROR] symbol: method getText()
[ERROR] location: variable date of type com.lastfm.playlists.server.service.api.lastfm.model.common.LastfmApiDateDto
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :service
这是我的主要pom.xml
:
<?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>
<groupId>com.lastfm.playlists</groupId>
<artifactId>server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<modules>
<module>api</module>
<module>service</module>
<module>common</module>
</modules>
<packaging>pom</packaging>
<name>server</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.target>1.9</maven.compiler.target>
<maven.compiler.source>1.9</maven.compiler.source>
<java.version>9</java.version>
<lombok.version>1.16.21</lombok.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-edge</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.lastfm.playlists.server.api.Application</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>9</source>
<target>9</target>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>
</build>
</project>
我的common
模块`pom.xml:
<?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">
<parent>
<artifactId>server</artifactId>
<groupId>com.lastfm.playlists</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.lastfm.playlists.server</groupId>
<artifactId>common</artifactId>
<packaging>jar</packaging>
<name>common</name>
</project>
关联的module-info.java
:
module common {
requires slf4j.api;
requires jackson.annotations;
requires lombok;
requires spring.data.commons;
requires spring.data.mongodb;
requires java.validation;
requires spring.core;
exports com.lastfm.playlists.server.common.utils;
exports com.lastfm.playlists.server.common.model;
exports com.lastfm.playlists.server.common.model.lastfm;
}
我的service
模块pom.xml
:
<?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">
<parent>
<artifactId>server</artifactId>
<groupId>com.lastfm.playlists</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.lastfm.playlists.server</groupId>
<artifactId>service</artifactId>
<packaging>jar</packaging>
<name>service</name>
<dependencies>
<dependency>
<groupId>com.lastfm.playlists.server</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
关联的module-info.java
:
module com.lastfm.playlists.server.service {
requires slf4j.api;
requires spring.beans;
requires spring.context;
requires spring.core;
requires spring.web;
requires lombok;
requires jackson.annotations;
requires common;
exports com.lastfm.playlists.server.service.api;
exports com.lastfm.playlists.server.service.api.lastfm.exception;
}
我的api
模块pom.xml
:
<?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">
<parent>
<artifactId>server</artifactId>
<groupId>com.lastfm.playlists</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.lastfm.playlists.server</groupId>
<artifactId>api</artifactId>
<packaging>jar</packaging>
<name>api</name>
<dependencies>
<dependency>
<groupId>com.lastfm.playlists.server</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lastfm.playlists.server</groupId>
<artifactId>service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
关联的module-info.java
:
module api {
requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.context;
requires spring.web;
requires spring.beans;
requires spring.data.commons;
requires java.validation;
requires slf4j.api;
requires common;
requires service;
requires spring.data.mongodb;
}