Saturday, January 2, 2016

How to install Maven on Eclipse


Hello everybody,

   Today I am going to show you how to import and use maven on eclipse.

1.    Open Eclipse IDE

2.    Click Help -> Install New Software...

3.    Click Add button at top right corner

4.    At pop up: fill up Name as "M2Eclipse" and Location as "http://download.eclipse.org/technology/m2e/releases" orhttp://download.eclipse.org/technology/m2e/milestones/1.0

5.    Now click OK
After that installation would be started.








6.Then you just need to open your project, and setup your pom.xml properly:




and then import your project.




Another way to install Maven plug-in for Eclipse:
1.    Open Eclipse
2.    Go to Help -> Eclipse Marketplace
3.    Search by Maven
4.    Click "Install" button at "Maven Integration for Eclipse" section
5.    Follow the instruction step by step
After successful installation do the followings in Eclipse:
1.    Go to Window --> Preferences
2.    Observe, Maven is enlisted at left panel
Finally,
1.    Click on an existing project
2.    Select Configure -> Convert to Maven Project


NOTE:
If you need to add any Maven library or dependency, execute the following:
mvn install:install-file
   -Dfile=<path-to-file>
   -DgroupId=<group-id>
   -DartifactId=<artifact-id>
   -Dversion=<version>
   -Dpackaging=<packaging>
   -DgeneratePom=true
Where: <path-to-file>  the path to the file to load
   <group-id>      the group that the file should be registered under
   <artifact-id>   the artifact name for the file
   <version>       the version of the file
   <packaging>     the packaging of the file e.g. jar
Or you manually add as below on your pom.xml file:



Happy coding,
Thiago

No comments:

Post a Comment