Intellij Build Works,Maven Build 失败
Posted
技术标签:
【中文标题】Intellij Build Works,Maven Build 失败【英文标题】:Intellij Build Works, Maven Build fails 【发布时间】:2017-10-28 21:56:04 【问题描述】:目前我正在使用我认为可能有用的所有技术构建一个微服务模板项目,以便人们可以将其用作项目的基础,而无需解决我遇到的所有问题。
现在的问题:在 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
【问题讨论】:
$global.version
的使用不会这样。请参阅docs how to use that in Maven 3.5.0。谁应该将 MountainMerge 注入(自动装配)到您的单元测试中?我没有看到 springboot 测试运行器的任何用法(如果我没记错的话)等。此外,您能否将 maven 构建的完整注销放入帖子中...查看真正的错误消息...
感谢到目前为止,我更改了 $global.version 并将 Autowire 更改为新的。错误还是一样。
请按照我的要求发布日志输出...检查了 springboot 文档如何运行单元测试?
我正在弄清楚如何以正确的格式添加日志现在它在那里;)在我遇到那个 maven 问题之前测试确实运行了(我试图用@Autowire 修复它,但现在是像原来一样再次测试)。
【参考方案1】:
在深入研究之后......父级中 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 默认值,这意味着它不能被类路径使用。
【讨论】:
非常感谢khmarbaise,这对我帮助很大。我能够解决我上面描述的所有问题 :) 更改在 github 中。它远非最终项目,但如果您看到其他一些我可以改进的地方,请随时批评该项目;)以上是关于Intellij Build Works,Maven Build 失败的主要内容,如果未能解决你的问题,请参考以下文章
IntelliJ强制更新Maven Dependencies