STS 打包时方法及问题
1、打包
右键项目run as—》maven clean
右键项目run as–》maven install
最好添加自己安装的的jdk路径:
jar包打好后,在target找到jar包:
在cmd中用java -jar spring-boot-quick-start-0.0.1-SNAPSHOT.jar运行即可
java -jar spring-boot-quick-start-0.0.1-SNAPSHOT.jar
ok,测试jar包成功。
2、问题一
The requested profile “pom.xml” could not be activated because it does not exist
右键项目–>properties–>删除pom.xml,保存即可
3、问题二
maven build 时Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project spring-boot-quick-start: Compilation failure
在打包插件以来中加入:
<defaultGoal>compile</defaultGoal>
4、maven install时 [ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR]No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
解决办法:
打开settings.xml 查看jdk、版本是否和自己设置的相同:
<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>
右键点击项目build path-》configure build path;编辑jre:edit——》选择jdk版本.