Trouble building for production

I have managed to build my application a couple of times in the past running mvnw clean package -Pproduction

But now I’m getting this error:

Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain

Any pointers in the right direction would be greatly appreciated!

Could it be possible that you have deleted / don’t have access to the .mvn folder within the repository?

I’m sorry to ask noobish question, but where should this folder have existed? :p I have tried to look for a mvn folder in the project but cant find it. The starting point of my application was a start.vaadin.com application and when I look in my old backups that I know I was able to build I cant find the folder there either.

If you build your application with mvn(w) the w stands for wrapper - meaning it is just a script that is downloading maven (mvn) and places it next to the script in a .mvn folder. If you have maven installed, you can execute the command without the w as well. Otherwise you probably have to get a .mvn folder from somewhere, e.g. from a new project created with start.vaadin.com and just add the .mvn from the downloaded archive to your repo next to the wrapper

Thanks for the quick and on-point explanation. I installed maven on my computer locally and ran it using only mvn command and that worked great!

I don’t understand why people are pushing these wrappers (mwnw & gradlew). Those bloat our git repositories and confuse new users. It can’t be that hard to install maven or gradle, if the version brought in with IDE is not enough :man_shrugging:

Somebody probably will bring up now the built tool version conflicts, but those are really rare. And if some project needs a legacy Maven, why not install mvnw at that poin :man_facepalming:

^ this - I totally hate it… but I understand the “need” to get new comers quick up and running. Only thing missing is a JDK now in the repository :shushing_face:

A quick comment from a new user is that it should be mentioned in the documentation that its recommended to install maven localy. I guess for exprerienced programmers this is self-explanatory, but for me at least I took the easy way out and used the wrapper. As @quintessential-ibex mentioned, this part confused me that I should run mvn and when that didn’t work I tried mvnw and that magicaly worked. Either drop the whole mvnw wrapper and force people to install maven or at least mention that you should install it localy :slightly_smiling_face: I’m out for now, thanks again!

More reasons to hate it: The outdated mvnw breaks the project with Quarkus CLI · Issue #100 · vaadin/base-starter-flow-quarkus · GitHub