使用IDEA和maven2,如何添加非maven .jar?

使用IDEA和maven2,如何添加非maven .jar?

问题描述:

我想在我的IDEA Web应用程序项目中包含一个使用maven2(pom.xml)的.jar。

I have a .jar that I want included in my IDEA web application project that is using maven2 (pom.xml).

如何添加.jar到我的不使用maven的项目?

How can I add a .jar to my project that isn't using maven?

你基本上有三种选择:

  • Install the jar in your local repository using install:install-file (see Guide to installing 3rd party JARs). This is pretty straightforward and easy but this will make your POM non portable. This might be an option if you are alone and doesn't plan to distribute your pom.xml.

使用部署:部署文件。这当然是企业环境中的理想和首选方案。

Deploy the jar in a corporate repository using deploy:deploy-file. This is of course the ideal and preferred scenario in a corporate environment.

如果您没有使用公司存储库但仍在团队中工作,设置基于文件的存储库和通过源存储库共享它。

If you're not using a corporate repository but are still working in team, setup a file based repository and share it through your source repository.