• In order to convert any java project in to maven using eclipse we need to install m2e plugin.
  • Latest versions of eclipse are coming with this m2e plugin by default.
  • If not found this plugin we can install it by help->install->click on add and enter http://download.eclipse.org/technology/m2e/releases. 
  • currently i am using eclipse oxygen version so it is having m2e plugin.
  • I have created a normal java project and i want to convert that into a maven project.
  • To convert any project in to maven right click on the project and ->configure->convert to maven project. 
  • After that a window will be opened and you need to enter group id and artifact id and then click on finish.  
  • convert to maven project eclipse luna / convert to maven project is not visible in eclipse /convert to maven project option not available in eclipse.



Right click on project and select configure-> convert to maven project.


convert to maven project java

Project will be converted to maven by creating pom.xml file.

how to convert to maven project java

 

pom.xml

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.or
  2. /2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  3. http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4.   <modelVersion>4.0.0</modelVersion>
  5.   <groupId>com.instanceofjava.maven</groupId>
  6.   <artifactId>MavenProject</artifactId>
  7.   <version>0.0.1-SNAPSHOT</version>
  8.   <build>
  9.     <sourceDirectory>src</sourceDirectory>
  10.     <plugins>
  11.       <plugin>
  12.         <artifactId>maven-compiler-plugin</artifactId>
  13.         <version>3.7.0</version>
  14.         <configuration>
  15.           <source>1.8</source>
  16.           <target>1.8</target>
  17.         </configuration>
  18.       </plugin>
  19.     </plugins>
  20.   </build>
  21. </project>

Add dependencies to your pom.xml file

  1.  <properties>
  2.         <springVersion>5.0.3.RELEASE</springVersion>
  3.       </properties>
  4.       <dependencies>
  5.         <dependency>
  6.           <groupId>org.springframework</groupId>
  7.           <artifactId>spring-context</artifactId>
  8.           <version>${springVersion}</version>
  9.         </dependency>
  10.        <dependency>
  11.          <groupId>org.springframework</groupId>
  12.          <artifactId>spring-core</artifactId>
  13.           <version>5.0.3.RELEASE</version>
  14.         </dependency>
  15.       </dependencies>

Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu