我正在为项目创建安装程序,并希望在 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/