0

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

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

as expected. Also if I diff one of these jar files with a copy of an older one, it is different.

I import this project into IntelliJ IDEA and build

Build completed successfully with 3 warnings

however

># 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

the mtime has NOT changed, and diff reports that the files are identical to copies of the earlier versions.

Why is IDEA not producing new jar files?

spraff
  • 32,570
  • 22
  • 121
  • 229

1 Answers1

0

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.

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 ...

I use spring boot but the principle remains the same with all simple java projects

Abneco
  • 101
  • 1
  • 8