简体   繁体   English

将整个项目导入Maven(Eclipse Juno)

[英]importing a whole project into Maven (Eclipse Juno)

I have a folder that contains some Java code, written specifically for Linux. 我有一个包含一些专门为Linux编写的Java代码的文件夹。

There is a pom.xml file and two folders called: src and build 有一个pom.xml文件和两个名为: srcbuild文件夹

I have installed Eclipse Juno on my Mac (10.7.5) and I understand it already has Maven included. 我在Mac上安装了Eclipse Juno(10.7.5),我知道它已经包含了Maven。 On the Linux machine, the code is executed by entering mvn package at the command line. 在Linux机器上,通过在命令行输入mvn package来执行代码。

But after this stage, during the execution of the build artifact, it doesn't run on my Mac, because some of the commands are specific to Linux (I am told). 但是在这个阶段之后,在执行构建工件期间,它不能在我的Mac上运行,因为一些命令是特定于Linux的(我被告知)。

How do I import the whole project into Maven on my Mac? 如何在Mac上将整个项目导入Maven? I mean where do I copy the folders and pom file? 我的意思是我在哪里复制文件夹和pom文件?

Thank you, H 谢谢,H

You can leave the maven project where it is. 您可以将maven项目保留在原处。 Go to

File->import->Maven->Existing Maven Projects->Root directory 

and select the maven project dir. 并选择maven项目目录。

If you cannot see Maven in Import menu it means you need to add maven plugin (m2e) to your Juno. 如果你在导入菜单中看不到Maven,则意味着你需要在你的Juno中添加maven插件(m2e)。 The fact that mvn runs from command line means only that maven is installed on your PC. mvn从命令行运行的事实意味着只在您的PC上安装了maven。

Complementing Evgeniy Dorofeev's answer: 补充Evgeniy Dorofeev的答案:

If your project is in a GIT repository and you use eGit, you might want to import it like this: 如果您的项目位于GIT存储库中并且您使用的是eGit,则可能需要将其导入为:

File->Import->Git->Projects from Git

After the import you can convert your project to a Maven project and it will update the project settings. 导入后,您可以将项目转换为Maven项目,它将更新项目设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM