Google

Apr 26, 2014

Creating a simple Java Web project with Maven tutorial -- Part 3 with eclipse

The part-1 and part-2 built the simpleWeb war  file outside eclipse using Maven. In this post, let's cover how eclipse interacts with Maven.

Step 1: start up your eclipse and verify if it has m2e (Maven to Eclipseplugin. Click on Help --> About Eclipse


Step 2:  Eclipse needs to know where your Maven settings.xml file is so that it can access your local repository.  Click on Window --> Preferences --> Maven --> User Settings.



Step 3: You can import any Maven artifact into eclipse. That is with a pom.xml file.  Click on File --> Import, and select "Existing Maven Projects" from within Maven.

Step 4: Browse and select your simpleWeb project.


Step 5: You can now work within eclipse.


Step 6:  Go to your DOS command prompt, and then run mvn eclipse:eclipse from the simpleWeb folder.

Step 7: Now come back to eclipse and select simpleWeb and press F5 to refresh the project. You should now see the referenced libraries read from your pom.xml file.



Step 8:  You can now run within eclipse by right-clicking on simpleWeb and then selecting RunAs  and then Maven clean, Maven install, Maven  test, etc. Alternatively, select "Maven build" and eneter a goal to execute like "package".




Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home