IntelliJ声称可以构建,但jar文件没有被触及 [英] IntelliJ claims to build but jar files are not touched
问题描述
我有一个使用mvn正确构建的Java项目
I have a java project that builds correctly using mvn
># mvn package
[ok]
># ls -il target/app.java target/app/ap.jar target/docker-app/app.jar
4239421 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:55 target/docker-app/app.jar
4239422 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:55 target/app/app.jar
4239416 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:55 target/app.jar
更改源代码,重新构建它,并且mtimes更改
change sources, build it again and the mtimes change
># mvn package
[ok]
># ls -il target/app.java target/app/ap.jar target/docker-app/app.jar
4239421 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:56 target/docker-app/app.jar
4239422 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:56 target/app/app.jar
4239416 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:56 target/app.jar
符合预期.同样,如果我 diff
这些jar文件中的一个与旧文件的副本进行比较,则它就不同了.
as expected. Also if I diff
one of these jar files with a copy of an older one, it is different.
我将此项目导入IntelliJ IDEA并进行构建
I import this project into IntelliJ IDEA and build
构建成功完成,并显示3条警告
Build completed successfully with 3 warnings
但是
># ls -il target/app.java target/app/ap.jar target/docker-app/app.jar
4239421 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:56 target/docker-app/app.jar
4239422 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:56 target/app/app.jar
4239416 -rw-r--r-- 1 me domain users 25305467 Apr 27 08:56 target/app.jar
mtime尚未更改,并且 diff
报告文件与早期版本的副本相同.
the mtime has NOT changed, and diff
reports that the files are identical to copies of the earlier versions.
IDEA为什么不产生新的jar文件?
Why is IDEA not producing new jar files?
推荐答案
Your question is very similar to this one, which I have already answered: intellj IDEA doesnt build jar properly It helps understanding. Well looked at the catches. (click zoom) This uses nvmw local to the project, nothing prevents you from using your nvm version.
intellij很好地提供了自己的构建构造系统,以创建没有maven的jar.(即使我个人无法正确设置它以使其能够启动应用程序.)
Namely intellij provided well, its own build construction system, to create jars without maven. (Even though I personally have not been able to set it up correctly for it to work for starting the application.)
但是,如果您要创建战争文件,我可以为您提供更多信息来创建战争文件...
But if you are looking to create a war, I can give you more information to create a war file ...
我使用spring boot,但原理与所有简单的Java项目相同
I use spring boot but the principle remains the same with all simple java projects
这篇关于IntelliJ声称可以构建,但jar文件没有被触及的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!