Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8208003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:11:26+00:00 2026-06-07T09:11:26+00:00

I’m trying to automate importing projects to an Eclipse workspace via commandline (using a

  • 0

I’m trying to automate importing projects to an Eclipse workspace via commandline (using a bash script). I have seen many posts suggesting using the CDT headless build even for non-C/C++ projects, but I want to avoid having to download CDT as my projects are all Java/Android projects and I want to be able to automate this for many people without having to make them all download CDT. I have tried the following with the JDT headless build with no avail:

eclipse -nosplash \
    -application org.eclipse.jdt.apt.core.aptBuild \
    -data [absolute_path_to_desired_workspace] \
    -import [absolute_path_to_project_directories]

Output shows “Building workspace” and then “logout,” but opening a session of Eclipse in the workspace shows nothing in the Package explorer.

Looking at the ./metadata/.log file in the workspace doesn’t seem to show any errors with the import.

Is it not possible to automate the import of existing Java Eclipse projects into Eclipse without using the CDT headless build?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:11:29+00:00Added an answer on June 7, 2026 at 9:11 am

    Unfortunately, JDT distribution doesn’t have any application that would support -import argument, like CDT’s org.eclipse.cdt.managedbuilder.core.headlessbuild. But you can easily write a simple one:

    package test.myapp;
    
    import java.util.LinkedList;
    import java.util.List;
    
    import org.eclipse.core.resources.IProject;
    import org.eclipse.core.resources.IProjectDescription;
    import org.eclipse.core.resources.IncrementalProjectBuilder;
    import org.eclipse.core.resources.ResourcesPlugin;
    import org.eclipse.core.runtime.NullProgressMonitor;
    import org.eclipse.core.runtime.Path;
    import org.eclipse.equinox.app.IApplication;
    import org.eclipse.equinox.app.IApplicationContext;
    
    public class Application implements IApplication {
    
        public Object start(IApplicationContext context) throws Exception {
    
            String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
    
            boolean build = false;
    
            // Determine projects to import
            List<String> projects = new LinkedList<String>();
            for (int i = 0; i < args.length; ++i) {
                if ("-import".equals(args[i]) && i + 1 < args.length) {
                    projects.add(args[++i]);
                } else if ("-build".equals(args[i])) {
                    build = true;
                }
            }
    
            if (projects.size() == 0) {
                System.out.println("No projects to import!");
            } else {
                for (String projectPath : projects) {
                    System.out.println("Importing project from: " + projectPath);
    
                    // Import project description:
                    IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(
                            new Path(projectPath).append(".project"));
                    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
                    project.create(description, null);
                    project.open(null);
                }
    
                // Build all projects after importing
                if (build) {
                    System.out.println("Re-building workspace");
                    ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
                    ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
                }
            }
            return null;
        }
    
        public void stop() {
        }
    }
    

    Your plugin.xml should contain something like:

    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.4"?>
    <plugin>
       <extension
             id="App"
             point="org.eclipse.core.runtime.applications">
          <application
                cardinality="singleton-global"
                thread="main"
                visible="true">
             <run
                   class="test.myapp.Application">
             </run>
          </application>
       </extension>
    </plugin>
    

    Create, and export your plug-in as “test.myapp_1.0.0.jar”. Then you can use it as follows:

    1. Copy test.myapp_1.0.0.jar to your Eclipse/dropins/ folder
    2. Copy all needed plug-ins to the target workspace directory:

      cp -r projects/* NewWorkspace/

    3. Import needed projects into the workspace:

      eclipse -nosplash -application test.myapp.App -data NewWorkspace -import /path/to/NewWorkspace/project1 -import /path/to/NewWorkspace/project2 etc…

    4. Now, you can safely remove test.myapp_1.0.0.jar from the Eclipse/dropins/ folder.

    I’ve uploaded all the code, including the exported plug-in here: https://github.com/spektom/eclipse-import

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.