How to Mavenize an Existing Eclipse Project Created General Guidelines on Mavenizing an Existing Eclipse project —> Create an empty Maven project of the same type as your original project (i.e. jar, war…) using the appropriate archetype. —> cd into the project directory that you just created and which now has a pom.xml file for your project. —> Run mvn eclipse:eclipse -DdownloadSources=true in this directory. —> Import the Maven project into Eclipse —> Move the original project’s source code and resources into the new Maven project structure. —> Get all your classpath dependencies into your pom.xml. See: How to Determine the Maven dependency to use for a jar Note, that unlike Eclipse, Maven has the concept of test scope for those dependencies that are required for testing, but not by the application itself. For example, for JUnit you would typically add a dependency like:If you do have an Ant build file, it may help you determine which artifacts are only required for tests. —> Clean up your Mavenized project. For example, you don’t need your lib directory and Ant’s build xml anymore. —> Make Maven happy. Suggested test: Delete you local maven repository Open a shell or command prompt and go where your project’s pom.xml is. Run mvn clean install Check if your local repo is back with your project and all the dependencies. —> Make your Eclipse happy. If it isn’t: Insure that your M2_REPO variable is properly defined (this needs to be done once per workspace). If not, you can set this via the command: mvn -Declipse.workspace= junit junit 3.8.1 test eclipse:add-maven-repo
How to Mavenize an Existing Eclipse Project
Concise, short, intro into Mavenising (’s’ not ‘z’, I’m a Limey) an existing project.
I’m unsure what mileage you’ll get out of this on more complex/modular existing projects, mainly from the point of view of manual conversion (Maven can handle modular projects) but this might be useful with many, if not only to get their head around Maven’s ‘coding by convention’ project layout and build life cycle concepts.