I know there were times it was very hard to us to move Java Projects to Maven. Lots of hurdle moving files from one directory to another, adding dependencies, etc.
You may need to install m2e-eclipse plugin in order to have this simple utility in Eclipse.
In your eclipse just right click on Java Project
and click Configure
and you should see “Convert to Maven Project
” option.
You should see dialogue like this below. Just add “Name
” and you should be all set.
Don’t forget to add your all custom dependencies in pom.xml
file.
Here is a sample pom.xml file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/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>CrunchifyJerseyEmbeddedHTTPServer</groupId> <artifactId>CrunchifyJerseyEmbeddedHTTPServer</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <warSourceDirectory>WebContent</warSourceDirectory> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> </project>