There is a problem
Ben had to change his work environment, and instead of a desktop Windows or MacBook, the company gave him an old Dell laptop, so he chewed the bullet and bought a new MacBookPro.
Buy computer for a while, reinstall software regret heartbroken. Of course, the software that Java programs must install is IDEA. The annotation template, shortcut keys, code styles, plug-ins, colors and other configurations of IDEA are the secret recipe of family. Therefore, I have made preparations for this.
The new week, I happily import the first project of the new company, configure the start information, then click start, lean back, deliciously ready to debug to see the logic.
Half a page of red letters popped up:
Not even in the startup phase, there was an error when building the module because the class in the Jar could not be found.
Trying to reason
There are no errors in my idea, and even Maven install is successful. Then ask colleagues what special configuration, the answer is no. Is there any problem with the configuration related to the build of my idea? No, this is a newly installed IDEA. I haven’t done any personalized configuration, and there is no problem compared with the configuration of my colleague’s IDEA.
Is the problem with IDEA itself? But my idea is downloaded from the official website.
Did I import my Settings folder?
Then come to the idea initialization import project page
Click Restore Default Settings, rework all configuration items, then start the import project again, start the project, success!! The problem is located. It’s the Settings folder!
I did not go into this before, just Google out of the migration of their idea configuration method, now let’s take a closer look at this folder in the end what things!
Most of the folders are known by name, you can click to have a look, we focus on options folder, click to have a look.
Inside is a path.macros. XML file that reads as follows:
The value of MAVEN_REPOSITORY is the same as it was on my previous computer, which is very suspicious! It is possible that idea uses this configuration to specify the location of JAR dependencies during build, so it is obviously not found.
Continue to open the jdk.table. XML file:
JDK configuration is also the old computer above! I’m using jdK1.8.0_181. I start to sweat… It turned out that there were so many holes in these files, no wonder IDEA went wrong.
Delete the above two files and import the Settings folder to start the project. Success!
The doctor
In fact, there is also a place where you can check the export item:
If he had taken a closer look and only selected the options he wanted instead of mindlessly “Select All,” he would not have crashed.
conclusion
As a senior code 🐶, the owner of the building will actually make such a mistake caused by the incomprehension, but also attempt to the idea official, is really shameless.
So, as a software engineer, there must be an engineer’s attitude, everything must personally understand its principle, no matter what, also want to check the official documents can start, must not face Baidu for Google programming, become a brick not thinking full of loopholes. You can’t use a lot of literary adjectives like “fast” to describe serious problems, you have to be able to give accurate figures and arguments.