i automated setting up eclipse, including importing existing maven projects.

first run mvn eclipse:eclipse on the project

   mvn eclipse:eclipse:

next grab an eclipse plugin that will perform the headless import of projects into the workspace:


copy the above jar to your /eclipse/dropins/ folder.

next find all the directories that can be imported into eclipse and append them with '-import'

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

# although it is possible to import multiple directories with one 
# invocation of the, this fails if one of the imports
# was not successful.  using a for loop is slower, but more robust
for item in ${imports[*]}; 
   import="$(dirname $item)/"
   echo "importing ${import}"

   # perform the import using the test.myapp_1.0.0.jar
   eclipse -nosplash \
      -application \
      -data $workspace \
      -import $import

finally, add the m2_repo variable to the workspace

mvn eclipse:configure-workspace

Related Query

More Query from same tag