Thursday, February 19, 2009

The import of netcomp

"netcomp" is the name of my little project.
Yesterday, after Samuel helped me modified it, I try to update the codes by cover the old files by the new ones. However, because Eclipse has some kind of history record for the old java files, after I re-open Eclipse to see the imported new java files, there are a lot of red crosses on the left side of the new packages and methods. Samuel told me to "Clean ..." and then "Update all the Maven projects" in the project menu of Eclipse. Because I didn't do it in the right order, it seemed useless. So I delete all the projects (there are kegg and netcomp previously) and try to import them in by click "import" and "Maven project". But it's wrong.
The right way to import the maven project to eclipse is,

Step 1. Unzip netcomp to D:\Projects. So now the right path for netcomp is D:\Projects\netcomp.

Step 2. run cmd and cd D:\projects\netcomp. Under this path, run : mvn eclipse:clean

Step 3. cd D:\projects\netcomp\netcomp. Under this path, run: mvn eclipse:eclipse.

Step 4. under D:\projects\netcomp, run: mvn clean install.
Up to now, my own .project for maven is generated.
Note: Run mvn eclipse:eclipse in the child netcomp, the one will be imported in the Eclipse as an existing java project later.

Step 5. In Eclipse, "Import" -> "General" -> "Existing Projects into Workspace" -> "Next" -> "Browse" to select the root directory. When you open "D:\Projects\netcomp" by browse, "netcomp" project will appear in the blank for Projects in this window. Then select it and "finish". If Kegg project appears in this blank too, omit it, it's enough only to import netcomp project.
Attention, in this step, it must be "Existing Projects into Workspace" instead of "Maven project" which is imported. It doesn't mean the option "Maven project" is useless, but since we've already built up the project by (cmd -> mvn eclipse:eclipse) , this project is an Existing project insead of an unbuilt Maven project. If you insist to use "import Maven project", then step 3 should be omitted. Or else, this import can be failed.

No comments: