Maven vs. Eclipse

11,702

Solution 1

Yes: managing transitive dependencies by hand is a fool's errand, and it has a ton of other functionality that is also complicated to do manually.

Relying solely on an IDE's build process is, in general, a Bad Idea. Not everybody uses the same IDE, or version of an IDE, or an IDE at all. Along with the latter, CI systems are headless and rely on build files.

Use an Eclipse-Maven plugin like m2eclipse or similar.

Solution 2

Maven is a powerful, extendable, open source project builder. The configuration is contained in the XML files, so it's easily accessible by the any text editor. If you want to share the configuration what you will do is just post the pom.xml. Many IDEs have converters of the project configuration to Eclipse and from Eclipse but this configuration is local and used internally by the development environment. Developers even not save such configuration in the VCS. Checking out such configuration has no sense. But maven is independent because it relies on external repositories that keep track of every library and version used by the project. Many IDEs including Eclipse have Maven support via plugins. That can keep intact both configurations.

Solution 3

Using maven you don't have to care about importing jars in project as it is mentioned in pom file. Also those jar will be downloaded from maven repository if they are needed(It should present on maven repository). It will also help you to make a all jars in one go(Need to configure only once) :)

Share:
11,702
Eddy
Author by

Eddy

Updated on June 04, 2022

Comments

  • Eddy
    Eddy almost 2 years

    I have a project written entirely in Java, and using several external Java libraries (hibernate, a couple of Apache commons, MQ, pretty standard stuff.)

    I'm used to working with Eclipse, but this project -- which I'm inheriting from a group of developers no longer in the company -- is relying on Maven.

    I have no idea why did they use Maven in the first place (they're not available for sharing this knowledge with me.) The project is medium size, and nothing the company is doing is too complex.

    Now my question is: is there any reason for me to keep Maven? Reading around, I can't find any real reason for doing so, and I'm especially unhappy about the directory structure, which requires me to go down 3 levels to get to the actual Java package, and Java code.

    (What I would like to do is simply move everything to Eclipse, using the Eclipse structure. It's a matter of 1-2 days of work to get it running, so no big loss of time, and from my point of view right now, it will make my life simpler moving forward, and allow me to do a better job for the company that hires me.)

    • Tim Bish
      Tim Bish about 11 years
      Why not just import the maven project into eclipse for development and use maven to build on the command line or in your CI framework builds.
    • bacar
      bacar about 11 years
      Eddy, this isn't an "either/or" choice. It's perfectly possible to use maven and eclipse together - the m2e plugin for eclipse makes this work reasonably well, most of the time...
    • Eddy
      Eddy about 11 years
      Thanks for replying, Tim and bacar. Why even bother with Maven? Eclipse builds everything out of the box, and it's doing a great job at this simple tasks.
    • Eran Harel
      Eran Harel about 11 years
      Is this for real, or are you just trolling?
    • Eddy
      Eddy about 11 years
      You are so fantastically funny, @Eran Harel, why waste your life on software? You should be a comedian!
    • Dave Newton
      Dave Newton about 11 years
      @Eddy It's a legitimate question: in general, the people that ask "Why use Maven?" are working on projects of trivial size with almost no dependencies. Not having run in to transitive dependency problems, not using a CI server, not needing cross-platform/environment repeatable builds, not needing the host of other automated functionality is generally indicative of tiny little projects with no thought given to anybody else involved. (There are alternatives to Maven, like Gradle/etc, but an IDE is not a Maven replacement.)
  • Eddy
    Eddy about 11 years
    So, do I understand correctly that there is a repository of jars somewhere, and once I specify its location Maven will automatically get the jars from it (and maybe even update the versions?) It sounds a bit crazy to me. I've worked on many projects and once I put all the required jars in Eclipse's lib directory I never had to worry about them ever again.
  • Eddy
    Eddy about 11 years
    Dave, can you look at my comment to the answer below? (and Thanks for replying.)
  • Sachin
    Sachin about 11 years
    Search on google regarding "maven repository" where all jars are kept. It will download the version of jar which you mention in pom file. It much handy as you don't need to worry about dependencies as they would be downloaded automatically :)
  • radai
    radai about 11 years
    @Eddy - a central jar repository isnt any "crazier" than linux package repositories or even smartphone app stores :-)
  • Eddy
    Eddy about 11 years
    @radal, I guess that internally an iPhone (for example) will have something akin to a pom file, so that if I loose my info it knows to go and get all the apps I purchased. But since I'm developing a project that needs a certain set of jars -- and I go and get them -- why would I bother managing a pom-like file myself, when I have an IDE doing that for me?
  • Sachin
    Sachin about 11 years
    @Eddy: If you are single developer then its OK. But when there are more number of developer present then if one developer adds a new jar each and every developer has to repeat action. But, with maven developers just need to clean and compile the code :)
  • Eddy
    Eddy about 11 years
    Thanks sachin, this makes a lot of sense. And yet even though not as elegant, that's all you'll have to do if you're on SVN or CVS or some such tool.
  • Dave Newton
    Dave Newton about 11 years
    @Eddy Because the IDE doesn't do that for you, unless you're using a dependency management system. For example, the project I'm currently working on, which is probably not even 50k lines of code, has 150+ dependencies. Why on earth would I want to try to figure out what I need to do to update a single dependency which in turns has its own dependencies? You're 100% wrong about how "easy" it is to do this by hand.
  • Dave Newton
    Dave Newton about 11 years
    @Eddy Try updating the version of anything. Even a relatively small Java project might have a half-dozen top-level dependencies, which in turn have dependencies, etc. Keeping track of that by hand is just foolish, very difficult, and can lead to hours of debugging.
  • yshavit
    yshavit about 11 years
    +1 for the IDE bit. Where I work, we have people using Eclipse, IntelliJ, Netbeans, emacs and vim. And it all works fine, because we stay away from IDE-specific features and use maven for the build.
  • Eddy
    Eddy about 11 years
    OK, I get it. For a project with 50K lines of code or more, and 150+ dependencies I'd want something like Maven. But the project I'm talking about doesn't even have 10K lines of code, and it requires no more than 40 jars to run (no other language dependencies, it's pure Java) and I'm pretty sure even some of these 40 are unnecessary and were just left there by the previous developers. But OK, I understand the point. Thank you.
  • Eddy
    Eddy about 11 years
    @DaveNewton Actually, It's still not entirely clear for me, and I want it to be. Let's say I'm using a library, and it has 10 dependencies. Hibernate, or Spring for example. In Eclipse I put all the required jars in the lib directory and forget about it for eternity. How does Maven simplify the process?
  • Dave Newton
    Dave Newton about 11 years
    @Eddy ... Obviously it doesn't simplify that exact process.
  • Eddy
    Eddy about 11 years
    @DaveNewton, so what would be a concrete example of a dependency that Maven does simplify?
  • Dave Newton
    Dave Newton about 11 years
    @Eddy I gave you 1,my simple project has over 150 dependencies.maven handled building and running tests on our continuous integration server. it publish is is the documentation, test results, and code metrics automatically. I don't know what else you want. You are completely ignoring what people are saying, and apparently have not done much research.