'What does it mean to "Mavenize" a project?

I've recently been asked to mavenize an existing project, and I don't know exactly what that means. On the maven website it outlines how to create a maven project from scratch, but what if I've already got a substantial amount of code?

I'm comfortable working on the command line or in Eclipse/Netbeans. I know there are a lot of plugins for the 2 IDE's that make this kind of thing easier but I don't know where to start.

Is there anything more to it than just writing a pom file that has all the dependencies in it?



Solution 1:[1]

It means to reorganise the projects code and resources to conform to the maven model. This use of 'convention over configuration' allows the standard maven tools to operate on your codebase.

Solution 2:[2]

In addition to what is said.

One can always convert an existing java project to a maven project with eclipse IDE, m2eclipse plugin supports such feature or option, as follows: After installing m2eclipse plugin and restarting eclipse. Right click java project --» configure --» convert to maven

You will have a generated pom to start with, almost always it needs modifications to match the projects dependencies and repositories if those dependencies aren't in the maven central repo.

Solution 3:[3]

Simply, just add the pom.xml file under your root (context) project folder. This will make your project as Mavenize project. Once you have added the pom file, then you can execute maven build life cycle commands from IDE terminal.

These maven life cycle commands associated with default maven plugins. So, below given basic declarations enough to start any simple Java project with Maven build.

<?xml version="1.0" encoding="UTF-8"?>
<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>org.example</groupId>
    <artifactId>AsyncService</artifactId>
    <version>1.0-SNAPSHOT</version>

</project>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PaulJWilliams
Solution 2 E_X
Solution 3 Vanam