Use VScode for non-maven web project
See original GitHub issueHi, i’ve been using VSCode with this extension for Maven Spring Boot Projects and it worked well, but now i have to work with an java web project, but not maven based, in which all my libraries are contained in WEB-INF/lib folder. The Problem is that after i open the project in VSCode it dows not recognize these libraries and it gives tons of import errors. Is there a way to make java web projects work without maven? Opening the project in eclipse runs just fine.
Here is the .classpath content of the project:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.5"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" path="WebContent/WEB-INF/lib"/> <classpathentry excluding="lib/" kind="src" path="WebContent/WEB-INF"/> <classpathentry kind="output" path="build/classes"/> </classpath>
Environment
- Operating System: Windows 10 Pro
- JDK version: 1.8.0.181
- Visual Studio Code version: 1.30.0 user setup
- Java extension version: v0.36.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
No, unless you can use Gradle as an alternative.
Eclipse project support is limited. To get it to work in your case, we’d need to bring Eclipse WTP into jdt.ls, the java language server, and provide some mechanisms to configure tomcat’s location. We decided to focus on the most commonly used build tools instead.
If the libraries in your WEB-INF/lib folder have been built with Maven, then converting the whole project to Maven would be the best solution. I encourage you to look into the Maven conversion mechanism we built into JBoss Tools/Red Hat Dev Studio a few years ago. If you’re interested, just install the JBoss Tools’ Maven bits from its update site into Eclipse, then right click on your project, Configure > Convert to Maven. Select the dependencies you want to add to your project, change their scope if needed, then finish the conversion. Hopefully, you should get something that works in both CLI, Eclipse and VS Code.