Author |
Topic: Maven -- Import Java project into Eclipse IDE |
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
Maven -- Import Java project into Eclipse IDE |
Once you have a Maven generated project, how can you convert it into Eclipse IDE?
Type in the following command where your poject with the pom.xml resides:
Output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.9:eclipse (default-cli) @ MyProject >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.9:eclipse (default-cli) @ MyProject <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ MyProject ---
[INFO] Using Eclipse Workspace: null
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
ER
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "MyProject" to C:\HelloWorld\Maven\MyFirstProje
ct\MyProject.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.402s
[INFO] Finished at: Tue Mar 27 17:16:21 PDT 2012
[INFO] Final Memory: 7M/124M
[INFO] ------------------------------------------------------------------------
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
What have been done? |
Two files have been created for your project:
.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MyProject</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created
with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
.classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
</classpath>
It should be noted a classpath variable M2_REPO has been referenced which must be declared in your Eclipse project build path.
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
Import into Eclipse IDE |
You can import it into Eclipse IDE now.
File -> Import… -> General -> Existing Projects into Workspace:
1)Type in your project folder in the Select root directory box: C:\HelloWorld\Maven\MyFirstProject\MyProject
2)Check Copy projects into workspace checkbox.
3)Click on Finish button.
|
|
|
|
|
|
|