如何在Intellij IDEA中复制maven依赖项以输出工件WEB-INF / lib?

如何在Intellij IDEA中复制maven依赖项以输出工件WEB-INF / lib?

问题描述:

我知道在eclipse中maven可以通过设置'部署程序集'和'构建路径'将依赖项复制到WEB-INF / lib目录,但是我怎样才能实现这一点Intellij IDEA?

I know in eclipse maven can copy dependencies to WEB-INF/lib dir by setting 'Deployment Assembly' and 'Build Path', but how can I achieve this with Intellij IDEA?

好的,我找到了解决方案:

Ok, I find a solution:

Intellij IDEA 中,Web应用程序存档( WAR )称为工件
您可以通过设置工件自动添加库:

In Intellij IDEA, a Web application archive (WAR) is called an artifact. And you can achieve adding libraries automatically by setting the artifact:


  • 打开项目结构设置窗口

  • 导航:项目设置 - >文物 - > **战争爆炸 - >输出布局 - > WEB-INF

  • 然后在WEB-INF下创建一个名为lib的目录,右键单击lib文件夹,你会看到 Add Copy of - 选项。

  • 选择库文件并添加所需的库。 [提示 Ctrl + A 可以在此处添加所有文件]

  • Open Project Structure setting window
  • Navigate:Project Settings --> Artifacts --> **war exploded --> Output Layout --> WEB-INF
  • Then create a directory named lib under WEB-INF, right click the lib folder, you will see Add Copy of- option.
  • Select Library Files and add the libraries you want. [Tips: Ctrl + A can work here to add all files]