programing tip

왜 메이븐?

itbloger 2020. 7. 1. 08:14
반응형

왜 메이븐? 장점은 무엇입니까? [닫은]


개미에 비해 maven을 사용하면 얻을 수있는 주요 이점은 무엇입니까? 도움이되는 도구보다 성가신 것 같습니다. 일반 Eclipse Java EE (m2eclipse 없음) 및 Tomcat과 함께 maven 2를 사용합니다.

메이븐 지지자들은

  1. Maven을 사용하면 패키지 종속성을 쉽게 얻을 수 있습니다

  2. Maven은 표준 디렉토리 구조를 갖도록 강요합니다

내 경험에

  1. 패키지 의존성을 파악하는 것은 그리 어렵지 않습니다. 어쨌든 거의하지 않습니다. 프로젝트 설정 중 한 번, 업그레이드 중 더 많을 수 있습니다. maven을 사용하면 일치하지 않는 종속성, 잘못 작성된 폼을 수정하고 어쨌든 패키지 제외를 수행하게됩니다.

  2. 느린 FIX-COMPILE-DEPLOY-DEBUG주기는 생산성을 저하시킵니다. 이것이 나의 주요 그립입니다. 변경하면 maven 빌드가 시작되고 배포 될 때까지 기다려야합니다. 핫 배포가 전혀 없습니다.

아니면 내가 잘못하고 있습니까? 올바른 방향으로 알려주세요. 저는 모두 귀입니다.


패키지 의존성을 파악하는 것은 그리 어렵지 않습니다. 어쨌든 거의하지 않습니다. 프로젝트 설정 중 한 번, 업그레이드 중 더 많을 수 있습니다. maven을 사용하면 일치하지 않는 종속성, 잘못 작성된 폼을 수정하고 어쨌든 패키지 제외를 수행하게됩니다.

장난감 프로젝트에는 그렇게 어렵지 않습니다. 그러나 내가 작업하는 프로젝트에는 실제로 많은 프로젝트가 있으며 표준화 된 이름 지정 체계를 사용하여 전 이적으로 가져 와서 매우 기쁩니다. 이 모든 것을 수동으로 직접 관리하는 것은 악몽입니다.

그리고 때로는 의존성의 수렴을 위해 노력해야합니다. 그러나 두 번 생각하십시오. 이것은 Maven 고유의 것이 아닙니다. 이것은 종속성을 사용하는 모든 시스템에 고유합니다 (일반적으로 Java 종속성에 대해 이야기하고 있습니다).

따라서 Ant를 사용하면 수동으로 모든 작업 을 수행해야 한다는 점을 제외하고 동일한 작업을 수행해야합니다. 일부 버전의 프로젝트 A 및 해당 종속성 가져 오기, 일부 버전의 프로젝트 B 및 해당 종속성 가져 오기, 사용하는 정확한 버전 확인, 확인 서로 겹치지 않고 호환되지 않는지 확인하는 등 지옥에 온 것을 환영합니다.

반면, Maven은 종속성 관리를 지원하고이를 전 이적으로 검색 하여 종속성 관리 고유 의 복잡성을 관리하는 데 필요한 툴링을 제공 합니다. 종속성 트리를 분석하고 전이 종속성에 사용되는 버전을 제어하고 일부를 제외 할 수 있습니다 그들 경우 필요한 마법이 없다 등의 모듈에 걸쳐 수렴을 제어 할 수 있습니다. 그러나 적어도 당신은 지원을합니다.

그리고 의존성 관리가 Maven이 제공하는 것의 일부일 뿐이라는 점을 잊지 마십시오. 훨씬 더 많은 것이 있습니다 (예를 들어 Sonar 와 같이 Maven과 잘 통합되는 다른 도구는 말할 것도 없습니다 ).

느린 FIX-COMPILE-DEPLOY-DEBUG주기는 생산성을 저하시킵니다. 이것이 나의 주요 그립입니다. 변경하면 maven 빌드가 시작되고 배포 될 때까지 기다려야합니다. 핫 배포가 전혀 없습니다.

첫째, 왜 이렇게 Maven을 사용합니까? 난 아니야 IDE를 사용하여 테스트를 작성하고 코드를 전달, 리팩터링, 배포, 핫 배포하고 커밋하기 전에 로컬 Maven 빌드를 실행하여 연속 빌드를 중단하지 않도록합니다.

둘째, Ant를 사용하면 상황이 훨씬 나아질 것입니다. 그리고 필자의 경험에 따르면 바이너리 의존성을 사용하는 모듈 식 Maven 빌드는 일반적인 모 놀리 식 Ant 빌드보다 빠른 빌드 시간을 제공합니다. 어쨌든 Maven Shell살펴보고 Maven 환경을 재사용 할 수 있도록 준비하십시오 (그런데 굉장합니다).

결국 유감스럽게도 유감스럽게도 생산성을 저하시키는 것은 Maven이 아니며 도구를 잘못 사용하는 것입니다. 그리고 당신이 그것에 만족하지 않는다면, 글쎄, 내가 말할 수있는 것은 그것을 사용하지 마십시오. 개인적으로 2003 년부터 Maven을 사용하고 있으며 결코 뒤돌아 보지 않았습니다.


Maven은 Ant와 같은 빌드 도구가 아닌 완벽한 프로젝트 개발 도구로 간주 될 수 있습니다. maven 플러그인과 함께 Eclipse IDE를 사용 하여 모든 문제를 해결해야합니다.

Maven 사용이점 페이지 에서 인용 한 Maven의 장점은 다음과 같습니다 .

헤닝

  • 빠른 프로젝트 설정, 복잡한 build.xml 파일 없음, POM 만 가능
  • 프로젝트의 모든 개발자는 중앙 집중식 POM으로 인해 동일한 jar 종속성을 사용합니다.
  • "무료"프로젝트에 대한 여러 보고서 및 메트릭 가져 오기
  • 병을 중앙 위치에서 잡아 당길 수 있기 때문에 소스 분포의 크기를 줄입니다.

엠마누엘 베니스

  • 많은 목표를 사용할 수 있으므로 ANT와 달리 특정 빌드 프로세스 부분을 개발할 필요가 없습니다. antrun 플러그인을 사용하여 빌드 프로세스에서 기존 ANT 태스크를 재사용 할 수 있습니다

제시 맥코넬

  • 모듈 식 코드 디자인을 촉진합니다. 여러 프로젝트를 간단하게 관리 할 수 ​​있으므로 디자인을 여러 논리 파트로 배치 할 수 있으며 pom 파일에서 종속성 추적을 사용하여 이러한 파트를 함께 제직 할 수 있습니다.
  • 모듈 식 코드 디자인을 시행합니다. lipservice를 모듈 코드로 지불하는 것은 쉽지만 코드가 별도의 컴파일 프로젝트에있을 때 종속성 관리에서 특별히 허용하지 않는 한 코드 모듈간에 수분 참조를 교차하는 것은 불가능합니다. 지금이 작업을 수행하고 나중에 구현을 수정하십시오.
  • 종속성 관리가 명확하게 선언되었습니다. 의존성 관리 메커니즘을 사용하면 jar 버전 관리를 망치려고해야합니다 ... '이 공급 업체 jar의 버전이 무엇입니까?'라는 고전적인 문제는 없습니다. 그리고 기존 프로젝트에서 설정하면 저장소에서 '알 수없는'버전을 만들어서 일을 시작하고 실행해야 할 때 기존 엉망에서 벗어납니다. ABC.jar의 실제 버전.
  • strong typed life cycle there is a strong defined lifecycle that a software system goes thru from the initiation of a build to the end... and the users are allowed to mix and match their system to the lifecycle instead of cobble together their own lifecycle.. this has the additional benefit of allowing people to move from one project to another and speak using the same vocabulary in terms of software building

Vincent Massol

  • Greater momentum: Ant is now legacy and not moving fast ahead. Maven is forging ahead fast and there's a potential of having lots of high-value tools around Maven (CI, Dashboard project, IDE integration, etc).

Figuring out dependencies for small projects is not hard. But once you start dealing with a dependency tree with hundreds of dependencies, things can easily get out of hand. (I'm speaking from experience here ...)

The other point is that if you use an IDE with incremental compilation and Maven support (like Eclipse + m2eclipse), then you should be able to set up edit/compile/hot deploy and test.

I personally don't do this because I've come to distrust this mode of development due to bad experiences in the past (pre Maven). Perhaps someone can comment on whether this actually works with Eclipse + m2eclipse.


Maven is one of the tools where you need to actually decide up front that you like it and want to use it, since you will spend quite some time learning it, and having made said decision once and for all will allow you to skip all kinds of doubt while learning (because you like it and want to use it)!

The strong conventions help in many places - like Hudson that can do wonders with Maven projects - but it may be hard to see initially.

edit: As of 2016 Maven is the only Java build tool where all three major IDEs can use the sources out of the box. In other words, using maven makes your build IDE-agnostic. This allows for e.g. using Netbeans profiling even if you normally work In eclipse


Maven advantages over ant are quite a few. I try to summarize them here.

Convention over Configuration
Maven uses a distinctive approach for the project layout and startup, that makes easy to just jump in a project. Usually it only takes the checkount and the maven command to get the artifacts of the project.

Project Modularization
Project conventions suggest (or better, force) the developer to modularize the project. Instead of a monolithic project you are often forced to divide your project in smaller sub components, which make it easier debug and manage the overall project structure

Dependency Management and Project Lifecycle
Overall, with a good SCM configuration and an internal repository, the dependency management is quite easy, and you are again forced to think in terms of Project Lifecycle - component versions, release management and so on. A little more complex than the ant something, but again, an improvement in quality of the project.

What is wrong with maven?
Maven is not easy. The build cycle (what gets done and when) is not so clear within the POM. Also, some issue arise with the quality of components and missing dependencies in public repositories.
The best approach (to me) is to have an internal repository for caching (and keeping) dependencies around, and to apply to release management of components. For projects bigger than the sample projects in a book, you will thank maven before or after


Maven can provide benefits for your build process by employing standard conventions and practices to accelerate your development cycle while at the same time helping you achieve a higher rate of success. For a more detailed look at how Maven can help you with your development process please refer to The Benefits of Using Maven.


Maven is a powerful project management tool that is based on POM (project object model). It is used for projects build, dependency and documentation. It simplifies the build process like ANT. But it is too much advanced than ANT. Maven helps to manage- Builds,Documentation,Reporing,SCMs,Releases,Distribution. - maven repository is a directory of packaged JAR file with pom.xml file. Maven searches for dependencies in the repositories.


I've never come across point 2? Can you explain why you think this affects deployment in any way. If anything maven allows you to structure your projects in a modularised way that actually allows hot fixes for bugs in a particular tier, and allows independent development of an API from the remainder of the project for example.

It is possible that you are trying to cram everything into a single module, in which case the problem isn't really maven at all, but the way you are using it.


This should have been a comment, but it wasn't fitting in a comment length, so I posted it as an answer.

All the benefits mentioned in other answers are achievable by simpler means than using maven. If, for-example, you are new to a project, you'll anyway spend more time creating project architecture, joining components, coding than downloading jars and copying them to lib folder. If you are experienced in your domain, then you already know how to start off the project with what libraries. I don't see any benefit of using maven, especially when it poses a lot of problems while automatically doing the "dependency management".

I only have intermediate level knowledge of maven, but I tell you, I have done large projects(like ERPs) without using maven.

참고URL : https://stackoverflow.com/questions/3589562/why-maven-what-are-the-benefits

반응형