Intellij Build Works,Maven Build失败

时间:2017-05-28 14:01:30

标签: java maven intellij-idea spring-boot dependencies

目前我正在构建一个微服务模板项目,其中包含我认为可能有用的所有技术,因此人们可以将其用作项目的基础,而无需解决我遇到的所有问题。

现在问题了:在Intellij中我可以运行我的Spring Boot应用程序但是当我要使用命令“mvn clean install”时,maven告诉我在ms-business内部找不到与其他类的依赖关系。另一个问题是,当我想运行 MountainMergerTest 类时,它无法从同一个模块中找到MountainMerger。

在这里您可以找到完整的项目:https://github.com/wscale/mountains

我最近改名为我的项目也许这搞砸了一下......但是因为我试图从github重新导入它可能会被破坏intellij文件现在应该已经消失了......仍然没有变化。

我非常感谢每一个帮助,因为我没有真正解决问题:/

mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] mountains
[INFO] ms-commons
[INFO] ms-persistence
[INFO] ms-business
[INFO] ms-ws
[INFO] ms-tests
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building mountains 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ mountains ---
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.3.RELEASE:repackage (default) @ mountains ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ mountains ---
[INFO] Installing /Users/Valdur/Documents/Development/Projects/mountains/pom.xml to /Users/Valdur/.m2/repository/org/wscale/mountains/0.0.1-SNAPSHOT/mountains-0.0.1-SNAPSHOT.pom
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building ms-commons 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ ms-commons ---
[INFO] Deleting /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ms-commons ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/src/main/resources
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ms-commons ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 12 source files to /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/target/classes
[WARNING] /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/src/main/java/org/wscale/commons/test/AbstractIT.java: /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/src/main/java/org/wscale/commons/test/AbstractIT.java uses unchecked or unsafe operations.
[WARNING] /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/src/main/java/org/wscale/commons/test/AbstractIT.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ms-commons ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ ms-commons ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ ms-commons ---
[INFO] Surefire report directory: /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ ms-commons ---
[INFO] Building jar: /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/target/ms-commons-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.3.RELEASE:repackage (default) @ ms-commons ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ms-commons ---
[INFO] Installing /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/target/ms-commons-0.0.1-SNAPSHOT.jar to /Users/Valdur/.m2/repository/org/wscale/ms-commons/0.0.1-SNAPSHOT/ms-commons-0.0.1-SNAPSHOT.jar
[INFO] Installing /Users/Valdur/Documents/Development/Projects/mountains/ms-commons/pom.xml to /Users/Valdur/.m2/repository/org/wscale/ms-commons/0.0.1-SNAPSHOT/ms-commons-0.0.1-SNAPSHOT.pom
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building ms-persistence 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ ms-persistence ---
[INFO] Deleting /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ms-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/src/main/resources
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ms-persistence ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ms-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ ms-persistence ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ ms-persistence ---
[INFO] Surefire report directory: /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ ms-persistence ---
[INFO] Building jar: /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/target/ms-persistence-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.3.RELEASE:repackage (default) @ ms-persistence ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ms-persistence ---
[INFO] Installing /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/target/ms-persistence-0.0.1-SNAPSHOT.jar to /Users/Valdur/.m2/repository/org/wscale/ms-persistence/0.0.1-SNAPSHOT/ms-persistence-0.0.1-SNAPSHOT.jar
[INFO] Installing /Users/Valdur/Documents/Development/Projects/mountains/ms-persistence/pom.xml to /Users/Valdur/.m2/repository/org/wscale/ms-persistence/0.0.1-SNAPSHOT/ms-persistence-0.0.1-SNAPSHOT.pom
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building ms-business 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ ms-business ---
[INFO] Deleting /Users/Valdur/Documents/Development/Projects/mountains/ms-business/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ms-business ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/resources
[INFO] skip non existing resourceDirectory /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ms-business ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/Valdur/Documents/Development/Projects/mountains/ms-business/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[5,35] package org.wscale.mountains.domain does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[13,10] cannot find symbol
  symbol:   class MountainEntity
  location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[20,5] cannot find symbol
  symbol:   class MountainEntity
  location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[26,32] cannot find symbol
  symbol:   class MountainEntity
  location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[26,5] cannot find symbol
  symbol:   class MountainEntity
  location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[32,34] cannot find symbol
  symbol:   class MountainEntity
  location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[39,33] cannot find symbol
  symbol:   class MountainEntity
  location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[9,37] package org.wscale.commons.exceptions does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[10,44] package org.wscale.commons.exceptions.errors does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[11,44] package org.wscale.commons.exceptions.errors does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[12,35] package org.wscale.mountains.domain does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[14,41] package org.wscale.mountains.repositories does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[20,13] cannot find symbol
  symbol:   class MountainRepository
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[3,33] package org.wscale.commons.merger does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[4,35] package org.wscale.mountains.domain does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[20,37] cannot find symbol
  symbol: class AbstractMerger
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[26,17] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[33,12] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[44,45] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[44,12] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[56,47] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[67,40] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[22,42] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.merger.MountainMerger
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[22,73] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.merger.MountainMerger
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[22,12] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.merger.MountainMerger
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[27,20] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[34,9] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[36,23] cannot find symbol
  symbol:   class NotFoundRuntimeException
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[37,25] cannot find symbol
  symbol:   class ErrorObject
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[46,23] cannot find symbol
  symbol:   class BadRequestRuntimeException
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[47,25] cannot find symbol
  symbol:   class ErrorObject
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[73,9] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[75,9] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[81,9] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[83,23] cannot find symbol
  symbol:   class NotFoundRuntimeException
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[84,25] cannot find symbol
  symbol:   class ErrorObject
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[92,23] cannot find symbol
  symbol:   class NotFoundRuntimeException
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[92,52] cannot find symbol
  symbol:   class ErrorObject
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[105,23] cannot find symbol
  symbol:   class BadRequestRuntimeException
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[106,25] cannot find symbol
  symbol:   class ErrorObject
  location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[24,9] cannot find symbol
  symbol:   class MountainEntity
  location: class org.wscale.mountains.merger.MountainMerger
[INFO] 41 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] mountains .......................................... SUCCESS [  0.786 s]
[INFO] ms-commons ......................................... SUCCESS [  3.162 s]
[INFO] ms-persistence ..................................... SUCCESS [  0.995 s]
[INFO] ms-business ........................................ FAILURE [  0.146 s]
[INFO] ms-ws .............................................. SKIPPED
[INFO] ms-tests ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.542 s
[INFO] Finished at: 2017-05-28T16:21:11+02:00
[INFO] Final Memory: 41M/282M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ms-business: Compilation failure: Compilation failure: 
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[5,35] package org.wscale.mountains.domain does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[13,10] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[20,5] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[26,32] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[26,5] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[32,34] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainService.java:[39,33] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: interface org.wscale.mountains.service.MountainService
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[9,37] package org.wscale.commons.exceptions does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[10,44] package org.wscale.commons.exceptions.errors does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[11,44] package org.wscale.commons.exceptions.errors does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[12,35] package org.wscale.mountains.domain does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[14,41] package org.wscale.mountains.repositories does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[20,13] cannot find symbol
[ERROR]   symbol:   class MountainRepository
[ERROR]   location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[3,33] package org.wscale.commons.merger does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[4,35] package org.wscale.mountains.domain does not exist
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[20,37] cannot find symbol
[ERROR]   symbol: class AbstractMerger
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[26,17] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[33,12] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[44,45] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/service/MountainServiceImpl.java:[106,25] cannot find symbol
[ERROR]   symbol:   class ErrorObject
[ERROR]   location: class org.wscale.mountains.service.MountainServiceImpl
[ERROR] /Users/Valdur/Documents/Development/Projects/mountains/ms-business/src/main/java/org/wscale/mountains/merger/MountainMerger.java:[24,9] cannot find symbol
[ERROR]   symbol:   class MountainEntity
[ERROR]   location: class org.wscale.mountains.merger.MountainMerger
[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 :ms-business

1 个答案:

答案 0 :(得分:0)

在深入研究之后......在父模型中使用spring-boot-maven-plugin并非故意用于多模块构建。这将继承到所有子模块,这意味着每个子模块将由spring-boot-maven-plugin:repackage重新打包并创建一个可引导的jar但不能被其他模块(类路径)消耗,这导致上面的大部分内容错误。如果您先将其注释到根父级中,那么在编译期间您会更进一步,但会因其他问题而失败。

您已将AbstractIT放入ms-commons中,您应将其提取到ms-tests区域中的src/main/java这样的单独模块,这意味着它将被打包到jar中,并且可以简单地在其他模块中重复使用模块。但是,通过使用此测试模块,您应该使用范围test来实现此依赖关系。

关于它在IDE中工作但不在Maven中工作的原因。在IDE中,模块将由IDE而不是Maven解析,这意味着如果您将模块导入IDE,则发现它不是基于支持的jar文件。但是在命令行上它只是基于依赖性而更严格,当然还基于创建的JAR文件。

如果您查看生产jar文件(通过spring-boot-maven-plugin:repackage):

Archive:  ms-commons/target/ms-commons-0.0.1-SNAPSHOT.jar
    testing: META-INF/                OK
    testing: META-INF/MANIFEST.MF     OK
    testing: BOOT-INF/                OK
    testing: BOOT-INF/classes/        OK
    testing: BOOT-INF/classes/org/    OK
    testing: BOOT-INF/classes/org/wscale/   OK
    testing: BOOT-INF/classes/org/wscale/commons/   OK
    testing: BOOT-INF/classes/org/wscale/commons/dto/   OK
    testing: BOOT-INF/classes/org/wscale/commons/exceptions/   OK
    testing: BOOT-INF/classes/org/wscale/commons/exceptions/errors/   OK
    testing: BOOT-INF/classes/org/wscale/commons/hateoas/   OK
    testing: BOOT-INF/classes/org/wscale/commons/merger/   OK
    testing: BOOT-INF/classes/org/wscale/commons/dto/ItemCollection.class   OK
    testing: BOOT-INF/classes/org/wscale/commons/exceptions/AbstractRuntimeException.class   OK
    testing: BOOT-INF/classes/org/wscale/commons/exceptions/ErrorObject.class   OK

它们包含正确的类,但jar中的位置不是jar默认值,这意味着它不能被类路径占用。