Does it still make sense to use Maven when dependent jars are checked in with source code?

前端 未结 3 937
失恋的感觉
失恋的感觉 2021-01-23 15:37

We check all of our source code\'s dependent third-party JARs into source control along with our source code. When needed, we manually download updates to third party JARs and r

相关标签:
3条回答
  • 2021-01-23 16:00

    When it comes to dependency management Maven really can be quite valuable. As Mark O'Connor suggests, running a local repository manager would likely be better than checking the artifacts into source control.

    There are many tools (like m2e in eclipse) that can help with dependency management and provide valuable feedback on which modules or dependencies require which other dependencies. Maven will also make sure to get the appropriate version of a dependency even if different modules depend on different versions of a given library. That will help prevent duplicate versions of the same jar showing up in your deployed project as long as they have the same group and artifact id.

    Even for a very simple project I don't think I would resort to checking dependencies into the source control system.

    0 讨论(0)
  • 2021-01-23 16:12

    "JARs dont change much", I hear this all the time.....

    Storing jars in the SCM is simple in the beginning of the project. Over time the number of jars gets larger and larger.... Wait 2 or 3 years and nobody remembers where the jars came from, what their licensing terms were and most commonly what versions are being used (important to know when analysing security vulnerabilities).....

    The best article I've read recently making the case for a repository manager is:

    • http://www.sonatype.com/people/2012/07/wait-you-dont-have-a-repository-manager/

    A little irreverant, but does make a valid point about the kind of technical inertia one encounters all the time.

    Switching a project team from ANT to Maven can be scary.... Maven works quite differently, so I find it is best deployed with greenfield or adventurous project teams. For the old-school ANT users, I recommend using the Apache ivy plugin. Ivy allows such teams to outsource the management of their dependencies but keep the build technology they're comfortable with.

    Ultimately the biggest benefit of using Maven are not dependency management. It's the standized build process. I've seen several failed attempts to create a "standard" ANT build process. Problem every build engineer has his opinion on what the standard should be.... Maven's approach of forcing users to write build plugins may appear restrictive in the beginning, but just like the iPhone eventually developers discover "there's a Maven plugin for that" :-)

    0 讨论(0)
  • 2021-01-23 16:17

    It's not only about 3rd Party Libraries. Mostly if you have multiple repositories. In our case, we had four repositories with lots of inter- and intra-dependencies. Actually I started this answer and then I had to go for 15 minutes to talk to some colleague about a problem happened after someone forgot to update the .jar of one project in the other's lib directory.

    And it looks more professional :)

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