Wednesday, 20 February 2013

How To import Git project as java project in Eclipse

Follow  simple steps to create a java project from git repository in eclipse :


  1. Create a git repository 
  2. Now in eclipse , use import wizard , select "Existing Projects in to workspace" and give path to your local git repository where the project files are located
  3. It will create the project , but it will be a simple project
  4. Now go to git repository location , there should be .project file which is created by eclipse 
  5. in .project file replace this code 

  6. <buildSpec></buildSpec>
    <natures></natures>
    
    
    to this code :
    <buildSpec>
      <buildCommand>
     <name>org.eclipse.jdt.core.javabuilder</name>
     <arguments>
     </arguments>
      </buildCommand>
    </buildSpec>
    <natures>
       <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
    
    
Now it will be converted to java project. Configure the build path accordingly . If there is pom.xml then you can convert it to maven project by right click the project and select convert to option then select maven project .