IntelliJ - 将 Java 项目/模块转换为 Maven 项目/模块
我有一个关于 Bitbucket 的项目.仅提交源.为了将项目检索到新机器上,我在 IntelliJ 中使用了 Version Control > Checkout from Version Control.
I have a project on Bitbucket. Only the sources are committed. To retrieve the project onto a new machine, I used Version Control > Checkout from Version Control from within IntelliJ.
然后询问我是否想从这个源创建一个新项目,我回答是.到现在为止还挺好.它为我创建了一个不错的 Java 小项目,由单个模块组成.
It then asks whether I would like to create a new project from this source, to which I reply Yes. So far, so good. It creates a nice little Java project for me, consisting of a single module.
然而,我将这个项目拉入 IntelliJ 的目标是将它变成一个 Maven 项目.我在任何地方都找不到任何可以让我这样做的选项!
However, my goal in pulling this project into IntelliJ was to turn it into a Maven project. I cannot find any option anywhere that will let me do this!
有没有办法让 IntelliJ 只为我生成一个基本的空 pom.xml,带有名称、artifactId 和存储库?或者,有没有办法首先将项目作为Maven项目导入?(每当我尝试从现有源创建项目时,它只会给我一个 Java 项目的选项.)
Is there a way to have IntelliJ just generate a basic empty pom.xml for me, with a name and an artifactId and a repository? Or, is there a way to import the project as a Maven project in the first place? (Whenever I try to create a project from existing source, it only gives me the option of a Java project.)
右键单击模块,选择添加框架支持...",并勾选Maven"技术.
Right-click on the module, select "Add framework support...", and check the "Maven" technology.
(这也会创建一个 pom.xml
供您修改.)
(This also creates a pom.xml
for you to modify.)
如果您的意思是添加源存储库元素,我认为您需要手动完成——不确定.
If you mean adding source repository elements, I think you need to do that manually–not sure.
Pre-IntelliJ 13 这不会将项目转换为 Maven 标准目录布局,13 岁以上就可以了.
Pre-IntelliJ 13 this won't convert the project to the Maven Standard Directory Layout, 13+ it will.