eclipse - 将现有 Maven 项目自动导入 Eclipse

标签 eclipse maven

我正在为项目创建安装程序,并希望在 checkout 项目后将现有的 Maven 项目导入到我的 eclipse 工作区中。

我会尽快得到任何帮助。

谢谢大家!

最佳答案

我自动设置了 Eclipse,包括导入现有的 Maven 项目。

首先在项目上运行mvn eclipse:eclipse

   mvn eclipse:eclipse:

接下来获取一个 eclipse 插件,它将执行项目到工作区的 headless 导入:

   wget https://github.com/snowch/test.myapp/raw/master/test.myapp_1.0.0.jar

将上述 jar 复制到您的 /eclipse/dropins/ 文件夹。

接下来找到所有可以导入到eclipse中的目录,并附加'-import'

IMPORTS=$(find . -type f -name .project)

# Although it is possible to import multiple directories with one 
# invocation of the test.myapp.App, this fails if one of the imports
# was not successful.  Using a for loop is slower, but more robust
for item in ${IMPORTS[*]}; 
do 
   IMPORT="$(dirname $item)/"
   echo "Importing ${IMPORT}"

   # perform the import using the test.myapp_1.0.0.jar
   eclipse -nosplash \
      -application test.myapp.App \
      -data $WORKSPACE \
      -import $IMPORT
done

最后,将M2_REPO变量添加到工作区

mvn eclipse:configure-workspace

关于eclipse - 将现有 Maven 项目自动导入 Eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17331788/

相关文章:

Eclipse 添加 Tomcat 7 空白服务器名称

eclipse中带有启动参数的Java程序

java - 将多个调试器连接到一个调试器(Java、JPDA)

java - Eclipse 无法识别生成的类

java - pom.xml 中的多个标签/预期 token 问题

java - 无法从资源加载定义

java - GWT重构: classes,模块,重命名整个项目

maven - 检查私有(private)存储库中是否存在 Artifact 或依赖项

android - Flex 移动 Maven 构建

java - 如何让 Maven 在 maven.build.timestamp 中显示本地时区?