- 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.
Project will be converted to maven by creating pom.xml file.
pom.xml
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.or
- /2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.instanceofjava.maven</groupId>
- <artifactId>MavenProject</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <build>
- <sourceDirectory>src</sourceDirectory>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </project>
Add dependencies to your pom.xml file
- <properties>
- <springVersion>5.0.3.RELEASE</springVersion>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${springVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>5.0.3.RELEASE</version>
- </dependency>
- </dependencies>
No comments