Issue
I have this old Java project without anything, I want to use maven with it because some dependencies are missing and I can't find the libs.
Can someone tell me how to convert that project to maven WITH VSCODE
.
Solution
Here are some steps:
- Tell VS Code to use Maven.
- Add a pom.xml to your project to spell out the dependencies.
- Ask Maven to download the dependencies to your local .m2 repository.
- Use the Maven lifecycle to compile/test/package your code.
You'll have no problem as long as all the JARs you need are in Maven Central. If some of them were internal to your organization you'll have to find them and pull them from a private repo or add them to your local .m2.
If this is an old Java project you might want to think about updating. Check the JARs for security vulnerabilities and upgrade them if you can. Hopefully there will be a good Junit suite to prove that upgrades didn't break your code.
One last suggestion: Try to compile and run it on a LTS version of the JDK - 11 or 17. Don't continue with JDK 8 - it's past the end of its support life.
This is easy in IntelliJ. I'd prefer it to VS Code.
Answered By - duffymo
Answer Checked By - Mildred Charles (JavaFixing Admin)