开发者

Working with Maven

开发者 https://www.devze.com 2023-01-13 01:57 出处:网络
I downloaded Java source code of some project that works with Maven. After checking out the code to Eclipse, and then building it from the command line, I followed the instructions

I downloaded Java source code of some project that works with Maven. After checking out the code to Eclipse, and then building it from the command line, I followed the instructions and imported it from Eclipse as: File > Import > Maven Projects. Now I hav开发者_JAVA技巧e the core source code and many additional sub projects that seem to have the same thing like the core, just separated.

Could anyone please explain me what are these sub projects? why I need them? and on which code I need to work now if I want to make changes, the core or the new imported Maven ones?

I don't know nothing about Maven besides the fact that it's a tool for building code and managing releases.

Thanks!


In Maven land, these are called modules. There a nice way to further divide a project into very distinct pieces.

People handle Maven differently. I've seen projects where there was the actual project module, then 10 or so implementation modules. Most people use them for the above mentioned separation.

Most likely, your going to need all of the modules in order to work correctly.

To modify the project, your going to need Maven. I don't know if Eclipse has an embedded maven, but at least NetBeans does. With this you can modify anything that you want, then build it with Maven, which should be just a simple click.


In addition to what @Quackstar said:

Eclipse has embedded Maven support provided by the m2eclipse plugin. When you import a Maven project consisting of multiple modules, the default behavior is to map each Maven module as a separate Eclipse project. This allows the Eclipse build paths to be constructed in a way that matches the declared Maven module dependencies.

There is also a way to map a multi-module Maven project into a single Eclipse project that entails enabling m2eclipse's "Nested Module" support. This results in an Eclipse project with a build path that is an amalgam of all of the Maven module dependencies ... and not exactly correct. This approach is not recommended by the m2eclipse developers, and I've heard they are intending to remove the nested module feature entirely in a future release.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号