question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use VScode for non-maven web project

See original GitHub issue

Hi, 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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fbriconcommented, Dec 20, 2018

Is there a way to make java web projects work without maven?

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.

0reactions
tarekahfcommented, May 9, 2022

Is it possible to create the sample web application in Eclipse and open it in vs code?

AFIAK it should work. /cc @jdneo @Eskibear I tried creating a simple dynamic web application and it worked in vscode, but, when I tried adding a Java Bean, it is not working. Check this post for details: https://stackoverflow.com/q/72159637/4180447

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building a non-maven project in VScode for Wildfly
I am looking for a way to build a non-maven spring mvc project with web.xml, where I want to use VSCODE with wildfly...
Read more >
Java Web Apps with Visual Studio Code
This tutorial shows you how to create a Java web application with Visual Studio Code. ... Install Apache Maven for your local development...
Read more >
Using VS Code with Java and Maven projects | Vaadin
Using VS Code with Java and Maven projects · 1. Install the “Java Extension Pack”. This installs the most essential extensions for Java...
Read more >
Converting existing projects to Maven - IBM
For web projects, artifacts can be deployed in the WEB-INF/lib directory. First, use the deployment assembly page to gather the dependencies information. Right- ......
Read more >
Develop your Spring Boot application with Visual Studio Code
Note: By default, VSCode Maven extension uses the Maven executable (mvnw) included in the project. You can specify the path to your local...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found