M2Eclipse가 화려하게 등장한 시점부터 나는 주로 프로젝트 빌드에 Maven을 활용했다.  M2Eclipse를 쓴 뒤로는 IDE에서 벗어나지 않고 Maven과 관련된 거의 대부분의 기능을 자연스럽게 이용할 수 있다. 이클립스의 프로젝트 설정, 빌드패스 등과도 유연하게 잘 연동되게 해주기 때문에 마치 이클립스가 제공하는 하나의 빌드 방식을 활용하는 느낌으로 사용한다.

사실 Maven을 사용하게 된 가장 중요한 동기는 수많은 라이브러리와 프레임워크를 일일히 프로젝트에 포함시키는 것이 너무 귀찮고, 리포지토리에 체크 인,아웃하는데 너무 오랜 시간이 걸렸기 때문이다. 물론 Maven으로 그런 의존파일을 관리하는 것이 그리 만만한 일은 아니었지만, 오랜 삽질을 거쳐 사용방법에 익숙해져가면서 그런대로 편리하게 사용하고 있다.

스프링도 2.0이후로 Maven POM 설정을 제공하고 있고 스프링의 S3 리포지토리, Central 그리고 스프링소스의 번들 리포지토리를 통해서 최신버전 또는 마일스톤버전의 스프링 artifact를 제공하고 있다.  하지만 새롭게 빌드 방법이 바뀐 3.0 이후로는 아직 공개적인 리포지토리에서 제공되는 3.0버전은 없다. S3나 스프링소스 리포지토리에서도 3.0 M1도 아직 찾을 수 없다.

3.0의 최신버전을 가지고 기능을 살펴보고 예제를 만들고 할 때 이 것이 가장 불편한 점이다. 스프링의 jar 파일도 3.0부터는 매우 잘게 쪼개져서 번들 형태로만 제공되기 때문에 더욱 그렇다.

최신 소스를 받아서 빌드를 하고 jar 형태로 패키징 하는 것 까지는 아무런 문제가 없다. 하지만 그것을 프로젝트에 사용하기 위해서 매번 일일히 프로젝트에 삽입하는 것도 번거로운 일이다.

그래서 내가 운영중인 OpenSprout의 Maven 리포지토리에 Spring 3.0의 최신버전을 디플로이 해서 사용하기로 했다.

 

Build

Spring 3.0의 최신 소스를 trunk에서 받아서 빌드하고 패키징 하는 것은 간단하다.

최신버전은 https://src.springframework.org/svn/spring-framework/trunk 에서 받으면 되고 ci-build.properties를 참조해서 환경설정을 한 뒤 build-spring-framework 폴더에서 ant jar 라고 하면 끝.

 

Deploy

이렇게 만들어진 스프링의 최신버전을 Maven에서 사용하기 위해서 리포지토리에 deploy를 한다.

먼저 Local Repository에 디플로이 하려면 다음 명령을 실행하며 된다.

ant publish-maven-local

주의할 것은 mvn이 아니고 ant라는 점이다. 스프링 3.0은 여전히 ant 빌드를 사용하고 있고 내부적으로 Maven-Ant Task를 이용해서 Maven관련 기능을 사용한다.

이렇게 하면 일단 로컬 리포지토리에 배포가 완료된다.

배포된 파일을 보면 버전이 3.0.0.BUILD-20090115xxxxxx 와 같은 형태로 나타난다. 좀 이상하게 생각되는 점은 분명 SNAPSHOT 버전이어야 할텐데 SNAPSHOT으로 되어있지 않다는 점이다. 각 모듈에 포함된 pom.xml을 보면 버전이 3.0-M1-SNAPSHOT으로 되어있지만 빌드과정에서 POM을 다시 ivy의 기능을 이용해서 직접 생성을 하는 것 같다.

아티팩트 이름이 저렇다면 Maven에서는 release 버전으로 취급된다. Snapshot이라면 계속 새로운 버전을 업데이트 하고 최신버전을 활용하는 것이 쉽게 가능할텐데 release버전으로 되어있으니 좀 난감하다.

일일히 pom.xml을 수정하고 폴더를 변경하지 않고 일단 사용할 수 있는 방법은 dendepency 설정을 할 때 version부분을 RELEASE로 세팅 하는것이다. 이러면 가장 최근에 등록된 release 버전을 참조하게 된다. 즉, 최신버전으로 항상 유지할 수 있는 것이다. LATEST로 해도 될 것 같은데, 테스트 해보면 LATEST로 설정하면 찾지를 못한다. Range로 설정하는 것이다. RELEASE로 처음에 하려고 했는데 일부 모듈에서는 제대로 가져오지만 일부 모듈은 아티팩트를 못찾는다고 에러가 발생한다. 여러가지 테스트 해본 결과 Maven의 버그(2.0.9, 2.1-M1)가 아닌가 생각된다. 대신 Range로 범위를 주면 그 중 가장 최신 것을 찾아온다.

 

 

다음엔 운영 중인 OpenSprout의 Maven Repository로 배포를 해보았다. 리포지토리 서버로는 Nexus의 1.2버전을 사용중이다.

먼저 서버에 spring-latest라는 아이디를 가진 hosted repository를 release 타입으로 하나 생성한다.

남은 작업은 위에서 빌드한 스프링의 모듈들을 디플로이 하는 것인데, 일일히 수동으로 하는 것은 육체건강에 좋지 않으므로 패스. 스프링 3.0의 Ant/Ivy 빌드파일에서 S3 리포지토리에 디플로이 하는 부분을 수정해서 OpenSprout 리포지토리로 변경하는 방법을 사용했다.

spring-build/common/publish.xml을 살펴보면 publish-maven이라는 앤트 타겟이 있다. 이 부분을 위에서 만든 OpenSprout의 리포지토리로 수정한다.

 
 
                
         
         
         
         
     
 

기존 설정에는 authentication 정보를 직접 주게 되어있는데, 아무리 해도 401에러가 나면서 실패한다. 그래서 Maven의 settings.xml에 해당 서버에 대한 id/password를 넣으니 잘 동작한다.

이렇게 설정을 마친 후

ant publish-maven

하면 모든 모듈들을 위의 리포지토리로 업로드 한다.

이제 http://www.opensprout.org/nexus/content/repositories/spring-latest/ 를 리포지토리로 등록하면 최신 스프링 3.0 을 사용할 수 있다.

 

Dependency/Repository

배포한 스프링을 사용하려면 pom.xml에 리포지토리를 추가한다.

 

    spring-latest
    Spring Latest by OpenSprout
    http://www.opensprout.org/nexus/content/repositories/spring-latest

...

그리고 필요한 스프링 모듈을 dependency에 넣으면 된다. 3.0은 아티팩트 이름이 기존의 방식과 다르게 만들어져있다는 점을 주의해야 한다.

 
    org.springframework
    org.springframework.core
    [3.0.0,]

버전을 Range로 주면 그중에서 가장 최신버전을 찾아서 사용한다.

 

이렇게 까지 하면 빌드시 에러가 날 것이다. 왜냐면 스프링의 POM에 등록된 다른 라이브러리들을 Central등에서는 찾을 수 없기 때문이다. 3.0의 POM에서는 스프링소스에서 제공하는 OSGi 번들로 재 패키징된 라이브러리를 참조하게 되어있다.

따라서 commons-loggings와 같은 것들도 Central이 아닌 스프링소스 리포지토리에서 가져와야 한다.

이를 위해 리포지토리에 스프링소스의 external 리포지토리를 추가한다.


    com.springsource.repository.bundles.external
    SpringSource Enterprise Bundle Repository - External Bundle Releases
    http://repository.springsource.com/maven/bundles/external

이렇게 해서 정기적으로 스프링의 최신 버전을 받아서 빌드하고, 배포하고 사용할 수 있는 준비가 끝났다.

Related posts:

  1. Maven의 version range를 사용할 때 주의할 점
  2. Maven의 다중 리포지토리에 존재하는 동일 artifact 사용시 주의점
  3. Maven의 default directory layout 변경하기
  4. Maven의 새로운 가이드북 – Maven: The Definitive Guide
  5. Spring 3.0 (3) R-543 Portlet Mocks, MVC 등등
  6. Spring 3.0 (27) R-599 JDK1.5+ Concurrent
  7. Maven과 OSGi(Spring)의 버전포맷 비호환 문제
  8. Spring 3.0 (1) 프로젝트 구조와 빌드 시스템의 변화
  9. Spring 3.0 (37) 스프링 모듈-라이브러리 의존관계 매트릭스 업데이트와 CTDD
  10. Spring 3.0 (30) R-723 JavaConfig 통합
  11. Spring 3.0 (25) Spring 3.0 빌드, 배포, 모듈과 라이브러리의 의존관계 분석 그 이후
  12. Spring 3.0 (35) Spring 3.0 Reference Document 공개
  13. Spring 3.0 (34) R-941 스프링의 Maven 지원정책은?
  14. Spring 3.0.2 모듈/라이브러리 의존관계
  15. Spring Framework 3.0.3 릴리스 & 의존 라이브러리

Facebook comments:

to “Spring 3.0 (4) – Maven에서 Spring 3.0 최신버전 사용하기”

  1. Fantastic goods from you, man. I have consider your stuff previous to and you’re simply too great.
    I really like what you have received right here, really like what you are stating and the way in which by which you are saying it.
    You’re making it entertaining and you continue to care for to stay it wise.
    I cant wait to read much more from you. This is actually a terrific website.

  2. Good way of telling, and fastidious paragraph to obtain data about my
    presentation subject, which i am going to deliver in college.

  3. Post writing is also a excitement, if you
    know then you can write or else it is complex to write.

  4. I’ve been exploring for a little for any high-quality articles
    or weblog posts in this kind of space . Exploring in Yahoo I ultimately stumbled
    upon this web site. Studying this info So i’m glad to express that
    I have a very good uncanny feeling I found out exactly what I
    needed. I such a lot without a doubt will make sure to don?t
    omit this website and provides it a look on a
    constant basis.

  5. This design is wicked! You most certainly know how to keep a reader
    amused. Between your wit and your videos, I was almost moved to
    start my own blog (well, almost…HaHa!) Excellent job.
    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

  6. Appreciation to my father who told me concerning this blog, this website is really remarkable.

  7. Hi! Quick question that’s totally off topic. Do you know how to make your site mobile friendly?

    My blog looks weird when browsing from my iphone. I’m trying to find a template or plugin that might be able to resolve this issue.
    If you have any suggestions, please share. Thanks!

  8. Way cool! Some very valid points! I appreciate
    you writing this write-up plus the rest of the site is really
    good.

  9. Attractive section of content. I just stumbled upon your website and in accession capital to assert that I get actually enjoyed account your
    blog posts. Any way I’ll be subscribing to your augment and even I achievement
    you access consistently rapidly.

  10. Hello, yeah this piece of writing is really nice and I have learned
    lot of things from it regarding blogging. thanks.

  11. It’s really a great and useful piece of information. I am satisfied that you
    shared this useful information with us. Please keep
    us up to date like this. Thank you for sharing.

  12. My programmer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs. But he’s
    tryiong none the less. I’ve been using Movable-type on several websites for about a year and
    am concerned about switching to another platform. I have
    heard very good things about blogengine.net. Is there
    a way I can import all my wordpress posts into it?

    Any kind of help would be greatly appreciated!

  13. JP08:20
    BIG SEXY LIVE CHAT FOR
    Hip-hop is going more

  14. I do not know if it’s just me or if perhaps everyone else experiencing problems with your blog.
    It appears as though some of the text within your content are running off the screen. Can someone else please comment and let me
    know if this is happening to them as well? This might be a problem
    with my browser because I’ve had this happen previously.

    Thank you

  15. Every weekend i used to go to see this web page, for the
    reason that i want enjoyment, for the reason that this this
    web page conations actually pleasant funny information too.

  16. Pretty component of content. I just stumbled upon your weblog
    and in accession capital to claim that I get in fact enjoyed account your
    weblog posts. Anyway I’ll be subscribing in your feeds and even I fulfillment
    you get admission to consistently quickly.

  17. Hello, i think that i saw you visited my weblog so i came to “return the favor”.I am trying to find things to improve my site!I suppose its ok
    to use a few of your ideas!!

  18. hi!,I really like your writing very so much!
    proportion we keep up a correspondence more about your article on AOL?
    I need an expert in this house to resolve my problem.

    Maybe that is you! Taking a look forward to look you.

  19. Appreciate you sharing, great blog.Thanks Again. Cool.

  20. Hey there! I know this is kinda off topic but I was wondering if
    you knew where I could locate a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding
    one? Thanks a lot!

  21. Wһat a material of un-ambiguity and preserveneѕs օf precious know-how concerning unexpected feelings.

  22. This is very handy if you’re in the early stages of a relationship and you haven’t
    closed the deal yet. You might be able to find an incredible deal for your favorite premium porn site here.
    But that’s the beauty of porn. Hardcore porn videos can fire
    your desire for sex hence it’s good to have a couple of
    sex movies in your personal drawer. If you can watch a porn movie or chat with a sexy girl over phone then you
    can feel the ultimate pleasure. For ultimate pleasure, you
    can ask your partner to help you achieve orgasm.
    Visualize your partner and use strong images when describing your actions.
    Using a love toy can free your both hands that you can use to press and caress your
    body for pleasure. The first line of Tulane’s press release suggested this might well be “one of the most significant scientific advances in the field of psychiatry”, and it was hard to disagree.
    Having a bundled package there is just one telephone number as well
    as only one accounts number for all 3 providers.

  23. I blog frequently and I truly appreciate your information. This article has really peaked my interest.
    I’m going to book mark yur ste and keep checking for new details about oncce
    a week. I opted in for your RSS feed as well.

    Also visit my web page; cosplay costumes

  24. Thanks a lot, Good information. global pharmacy canada

  25. Actually when someone doesn’t know afterward its up to other
    viewers that they will assist, so here it takes place.

  26. Great article post.Thanks Again. Keep writing.

  27. It’s very straightforward to find out any topic on web as compared
    to textbooks, as I found this article at this site.

  28. Very nice post. I just stumbled upon your weblog and wanted to say that I’ve really enjoyed surfing around your blog posts.
    In any case I’ll be subscribing to your rss feed and I hope you write again very soon!

  29. best online casino that takes discover
    best online blackjack australia
    casino game for mac

  30. Very good info. Lucky me I recently found your site by accident (stumbleupon).

    I have bookmarked it for later!

  31. I visited multiple blogs but the audio feature for audio songs existing at
    this website is in fact wonderful.

  32. Hmm is anyone else encountering problems with the images on this blog loading?
    I’m trying to determine if its a problem on my end or
    if it’s the blog. Any responses would be greatly appreciated.

  33. It’s as simple is that. If you want to dress like a girl.

    I don’t give a fuck. But when you overstep and think I have to play in your storybook
    land. Not going to happen. A male is a male even if he feels like a female.

  34. Hello just wanted to give you a quick heads up. The text in your post
    seem to be running off the screen in Chrome. I’m
    not sure if this is a formatting issue or something to
    do with internet browser compatibility but I thought I’d post to let you know.
    The layout look great though! Hope you get the problem resolved soon. Thanks

  35. Somme times itts a painn in the ass to read what people wrote buut this site is real user friendly!

  36. Hello to all, the contents existing at this website are actually remarkable for
    people knowledge, well, keep up the good work fellows.

  37. Greetings! I know this is kinda off topic nevertheless I’d
    figured I’d ask. Would you be interested in trading links or maybe guest authoring a blog post or vice-versa?
    My blog goes over a lot of the same topics as yours and I believe we could
    greatly benefit from each other. If you might be interested feel free to shoot me an e-mail.
    I look forward to hearing from you! Superb blog by the way!

  38. Wonderful website you have here but I was wanting to know if you knew of
    any message boards that cover tthe same topics discussed in this article?
    I’d really love to be a part of community where I can get feed-back fdom other knowledgeable people that share the same interest.
    If you have any recommendations, please let me know. Thanks a lot!

    Feel free to visit mmy wweb blog: cosplay costumes

  39. I every time spent my half an hour to read this blog’s posts every day along with
    a mug of coffee.

  40. We absolutely love your blog and find most of your post’s to
    be what precisely I’m looking for. Do you offer guest writers to write content available for you?
    I wouldn’t mind creating a post or elaborating on a number of
    the subjects you write related to here. Again, awesome site!

  41. great post, very informative. I ponder why the other
    specialists of this sector don’t understand this. You must proceed your writing.
    I am confident, you have a huge readers’ base already!

  42. I’m curious to find out what blog system you have been utilizing?
    I’m experiencing some small security problems with my latest
    blog and I’d like to find something more safeguarded.
    Do you have any recommendations?

  43. I constantly spent my half an hour to read this weblog’s articles every
    day along with a cup of coffee.

  44. TINY TEEN EMMA HIX FUCKED HARD AND CREAMPIED ON HER FACE

    poorvi cid girl>nud> sex seventeen lesb free tube>ww> kaitlyn ass and boobs jenni farley fake fucked spezialteenie fuck
    high school teens masterbating videos chi>

  45. Good day! I know this is kind of off topic but I was
    wondering which blog platform are you using for this site?
    I’m getting sick and tired of WordPress because I’ve
    had issues with hackers and I’m looking at
    alternatives for another platform. I would be awesome if you
    could point me in the direction of a good platform.

  46. Right here is the right web site for anyone who wants to find out about this topic.
    You know so much its almost tough to argue with you (not that
    I personally would want to…HaHa). You definitely put a new spin on a subject which has been discussed for
    decades. Excellent stuff, just wonderful!

  47. Many thanks, Plenty of forum posts!
    citalopram medication

  48. For the reason that the admin of this web site is
    working, no doubt very rapidly it will be famous,
    due to its feature contents.

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Toby's Epril Suffusion theme by Sayontan Sinha