Mavnen 报错记录,公司电脑和家里电脑idea版本不同,暂未解决
公司电脑---->mvn命令编译失败,直接启动失败, 启动方式 先compile 使用lifeycle编译,然后在使用package 这样是可以编译通过,打出来jar包的,勉强算是启动成功
- IDEA版本 2020 无法使用右侧 maven install 编译成jar包和war包 执行代码时会报错
- maven版本 apache-maven-3.6.1
- 使用配置的本地maven仓库
家里电脑----->依然使用mvn clean install 命令是可以编译打包成功的 ,启动ok
其实就idea版本和公司不同
值得注意的是这里是使用mvn在cmd中打包的 在idea中打包依然会报错 错误最下图
- IDEA版本2018.2
- maven版本 apache-maven-3.6.1
- 使用配置的本地maven仓库
在idea中使用命令打包
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-cli) @ b-xxxx---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for b-parent 1.0:
[INFO]
[INFO] axxxx........................................... SUCCESS [ 0.374 s]
[INFO] axxxx............................................ FAILURE [ 0.007 s]
[INFO] axx............................................ SKIPPED
[INFO] axx.............................................. SKIPPED
[INFO] xxxx.......................................... SKIPPED
[INFO] xxxxxx.............................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.769 s
[INFO] Finished at: 2020-11-09T21:48:31+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-cli) on project b-utils: The packaging for this project did not assign a file to the build artifact -> [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 <goals> -rf :b-utils
Process finished with exit code 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.860 s
[INFO] Finished at: 2020-11-12T09:57:58+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project xxxxxxx: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[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 :b-utils
找到解决办法了!!!
https://www.xinke.org.cn/article/detail/775
1 . 在maven的setting.xml 文件 标签中加入指定JDK的版本\
D:\ProgramFiles\maven\apache-maven-3.6.1\conf/settings.xml
<profile>
<id>JDK-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
- pom文件添加
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<fork>true</fork>
<executable>
C:\Program Files\Java\jdk1.8.0_211\bin\javac.exe
</executable>
</configuration>
</plugin>
</plugins>