Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the correct procedure to add JARs into WEB-INF/lib directory in IntelliJ

Say I have a Java web project and I need to place a couple of JARs into the WEB-INF/lib directory. In Eclipse, if you simply place those JARs there, Eclipse picks them up as on the classpath. However, IntelliJ doesn't seem to.

What is the correct way of adding those JARs into the project such that they are in the standard WEB-INF/lib directory?

like image 604
user1902183 Avatar asked Nov 06 '13 03:11

user1902183


People also ask

How do I add libs to IntelliJ?

From the main menu, select File | Project Structure | Project Settings | Modules. Select the module for which you want to add a library and click Dependencies. button and select Library. In the dialog that opens, select a project or a global library that you want to add to the module.

What is path to jar in IntelliJ?

From the main menu, select File | Project Structure Ctrl+Alt+Shift+S and click Artifacts. Click. , point to JAR, and select From modules with dependencies. To the right of the Main Class field, click.


2 Answers

In the Project Structure window, after adding the JAR in the section "Libraries", you can go to the section "Artifacts" and you'll see in the register "Output Layout" how the WEB-INF folder will look like. On the right side you see "Available Elements", which you can drag&drop to the left site into the lib folder.

like image 186
Anton Kaiser Avatar answered Oct 12 '22 23:10

Anton Kaiser


The only way i could do this is by adding the required jars manually to the WEB-INF/lib folder on the file system and add that to project library explicitly (apart from the way to add via module library as described in the linked SO question).

enter image description here

Hope that helps.

like image 42
iCrus Avatar answered Oct 12 '22 23:10

iCrus