我有一个
project.最初它是一个单一模块项目,结构如下
java-cloud-sample\
src\
main\
java
pom.xml
我决定将它变成一个多模块结构 – 无论如何我使用java 9.
所以我把它分开了
java-cloud-sample\
java-cloud-rest-api\
src\
pom.xml
pom.xml
root pom.xml看起来像这样
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.lapots.breed.platform.cloud
java-cloud-sample
0.0.1-SNAPSHOT
pom
java-cloud-rest-api
org.springframework.boot
spring-boot-starter-parent
1.5.6.RELEASE
UTF-8
UTF-8
1.9
1.9
org.apache.maven.plugins
maven-compiler-plugin
3.6.2
org.apache.maven.plugins
maven-jar-plugin
3.0.0
org.apache.maven.plugins
maven-dependency-plugin
3.0.1
copy-dependencies
package
copy-dependencies
模块pom.xml看起来像这样
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.lapots.breed.platform.cloud
java-cloud-sample
0.0.1-SNAPSHOT
java-cloud-rest-api
Demo project for Spring Boot
jar
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-devtools
runtime
com.h2database
h2
runtime
org.postgresql
postgresql
runtime
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin
build-info
${project.build.sourceEncoding}
${project.reporting.outputEncoding}
${maven.compiler.source}
${maven.compiler.target}
但是当我尝试运行mvn clean package时,我得到了
INFO] java-cloud-rest-api ................................ FAILURE [ 1.060 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.104 s
[INFO] Finished at: 2017-09-08T17:15:46+03:00
[INFO] Final Memory: 27M/331M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile (default-compile) on project java-cloud-rest-api: Fatal error compiling: invalid flag: --module-path -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :java-cloud-rest-api
问题是什么? (也许我应该将maven项目拆分为单独的模块,并将每个maven模块拆分为java模块)