What does it mean to “Mavenize” a project?

后端 未结 3 1732
天命终不由人
天命终不由人 2020-12-14 19:01

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 scr

相关标签:
3条回答
  • 2020-12-14 19:26

    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.

    0 讨论(0)
  • 2020-12-14 19:31

    To "Mavenize" simply means to write a POM (and possibly move code around) so that it builds in Maven.

    Often the easiest way to do this is to restructure your code slightly so it matches Maven conventions (e.g. move "sources" to "src/main/java", and explicitly split up separate modules). You can ignore the conventions, and tell Maven how you're storing your classes etc., but in general a small bit of pain up front to make most of Maven then work "out of the box" is worth investing in.

    Chances are the vast majority of your Ant (or similar) file is boilerplate, which was the idea behind Maven in the first place. However, there may be some bespoke stuff in there (e.g. test classes that start with "TestIntegration" should only be run on nightly builds) which you'll need to reproduce in Maven.

    But yeah, in general it means to take the existing functionality of a build, and reproduce that same functionality using Maven.

    0 讨论(0)
  • 2020-12-14 19:31

    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.

    0 讨论(0)
提交回复
热议问题