Reputation: 15129
When I started my project, I wasn't aware of Maven.. I realized the importance of it after the project had already grown to a pretty large size. At that time I was really into rapid development, hence I didn't really want to break the flow. So, I deferred plugging maven into the project. Now I have a little breathing space, so I'd like to add maven into the project.
What do your suggest I do or should I even do it? I have Spring, Struts, Log4J, Hibernate and JAX-RS in the project.
Upvotes: 17
Views: 24245
Reputation: 1034
In eclipse you can convert exciting project to maven simply by m2e-eclipse plugin.
but in intllje, you can create new maven project and then simply move class to src/java/packagename and configuration to resource folder. then you can add every dependency your project needed from compile error log.
Upvotes: 1
Reputation: 15129
Ok.. I did eventually shift the project to maven. Here's what I did.
In case you have a multi module project, then convert the other modules to maven as described above and add the dependent module to pom.xml of the other module.
If you have custom jars which aren't maven based, you can add them in the src/main/resources folder and then add the jars to build path.
There you go! Easy peasy!
I have a skeletal project setup for Spring + Maven + EC2. You can use that for creating, configuring maven and automating deployment process.
https://github.com/varunachar/maven-release
Upvotes: 28
Reputation: 8969
The difficulty will depend on how much you know about maven and how big your project is. It is always easier to play with a small project first and see how it goes. It does not matter what libraries it depends on as long as they are in maven central repository or in a known online location. If the libraries you are suing doesn't exist on any online maven repositories then you will need to deploy you jar files either locally or your own online place. If you cannot find a good hosting service you can even put it on Github. Here is the trick.
There are quite a few interesting articles on converting ant project to maven project which you should read. Here is the first hit on google search http://www.sonatype.com/people/2009/04/how-to-convert-from-ant-to-maven-in-5-minutes/
My only comment is to make the best use of your IDE when you are converting your projects. For example, use refactor features in your IDE when you move your codes. For me, I found that the maven support in Netbeans is extremely useful and easy to use.
Upvotes: 2
Reputation: 6656
I faced exactly the same situation like you. Additionally to maven I migrated from JavaEE5 to JavaEE6. I have done the migration step by step:
By doing this you have a smooth migration from your existing structure to Maven. At the end of the day you benefit more and more from your maven structures and always are able to further develop your project.
Upvotes: 4