Maven archetype을 만들 때 가장 귀찮은 작업중의 하나는 META-INF/archetype.xml을 만드는 것이다. archetype-resources 밑에 표준 폴더 구조와 클래스, 파일들을 만드는 것은 힘들지 않지만 그 파일 정보를 일일히 archetype.xml에 source,resource,testSource등으로 구분해서 넣어주어야 한다.

Archetype이 단순하면야 뭐 어렵지 않겠지만 파일이 많고 폴더가 복잡한 경우 xml 편집만 해도 상당한 스트레스이다. 문제는 이 xml을 검증하는게 deploy하고 나중에 archetype기반으로 create할 때에 검증이 된다는 것이다. 기껏 올리고선 에러가 나서 살펴보면 xml 오타나 파일 추가한 것을 잊고 xml에 안올렸다거나 하는 것들이 많다.

결국 귀찮은 나머지 archetype-resources 폴더 아래의 모든 파일목록을 읽어서 분류한 후 자동으로 archetype.xml을 만들어 주는 간단한 유틸리티 코드를 만들기로 했다.

자바로 할까 하다가 Ruby 연습도 할 겸 TDD방식으로 해서 Ruby로 작성했다. 두개의 클래스를 만들었는데 만들고 나니 코드가 너무 간결해서 하나의 클래스로 해도 충분했을 듯 싶다.  Ruby의 각 클래스와 메소드에 익숙하지 않고 최적화된 코드가 뭔지 매번 생각하고 레퍼런스를 뒤져보는 것이 좀 불편한 점. 주변에 Ruby에 대해서 도와줄 사람이 없으니 혼자 이것 저것 뒤져가며 공부를 하면서 해야 하는 것이 제법 만만치 않다. 거기다 Eclipse/RDT plugin을 사용했지만 자동완성 기능이나 type browsing기능이 없는 것이 불편했고. 테스트 수행시 단순한 오타로 인한 fail이 30%쯤 되는 것 같다. RI view의 도움을 받아가며 겨우 겨우 작업해서 완성. 아직 넣지 않은 것은 siteResources인데.. 이건 site 만들 때 추가하면 될테고.

이제 archetype.xml 노가다 작업은 걱정하지 않아도 되겠다.

Ruby로 테스트코드 만들면서 가장 인상에 남았던 것은 mock만들기가 아주 아주 쉽다는 것이다. 자주 들은 이야기지만 실제 적용해보니 그 단순함에 감동을 했다.

파일은 src/main/ruby와 src/test/ruby에 있으면 되고. 실행할 때는 프로젝트 루트폴더가 current directory여야 한다. Eclipse에서 돌리면 디폴트 조건이다.

archetype_xml_writer.zip

그런데 혹시 Maven에 archetype.xml을 자동 생성해주는 기능이 이미 있는 것은 아닐까? 그렇다면 대략난감…

Related posts:

  1. 스프링 컨테이너에는 설정파일이 없다
  2. Maven 의존관계 수렁에 빠지다
  3. Maven POM에 attribute 사용하기 (2)
  4. Spring 3.0 (59) 프로퍼티 파일 이용하기 – placeholder vs SpEL
  5. Ruby on Maven
  6. Maven POM에 attribute 사용하기 (1)
  7. 톰캣 앞에 아파치 웹 서버(Httpd)를 두어야 할까?
  8. Maven 재도전기 (1)
  9. 파이썬 완벽 가이드 전자책
  10. Maven settings.xml의 비밀번호 암호화
  11. Ruby를 공부하면서…
  12. Maven 다중 리포지토리와 버전 범위를 사용할 때의 주의점
  13. Nexus Maven Repository 1.0 출시
  14. Maven 3.0과 버전 포맷 문제
  15. Spring 3.0 (34) R-941 스프링의 Maven 지원정책은?

Facebook comments:

to “Maven archetype 설정파일 자동생성기 – ArchetypeXmlWriter”

  1. When I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and from now on whenever a comment is added I receive 4 emails with the exact same comment. Is there a way you can remove me from that service? Thanks a lot.

  2. Pretty! This has been an incredibly wonderful post. Many thanks for providing this information.

  3. Howdy, i read your blog occasionally and i own a similar
    one and i was just wondering if you get a lot of spam
    feedback? If so how do you stop it, any plugin or anything you can recommend?

    I get so much lately it’s driving me mad so any assistance is very
    much appreciated.

  4. here are some hyperlinks to web pages that we link to since we think they’re really worth visiting

  5. I’m impressed, I must say. Seldom do I come across a blog that’s both equally educative and engaging, and let me tell you, you have hit the nail on the head. The issue is something which too few men and women are speaking intelligently about. Now i’m very happy that I found this during my hunt for something regarding this.

  6. This site was… how do I say it? Relevant!! Finally I’ve found something which helped me. Many thanks.

  7. I truly love your website.. Excellent colors & theme. Did you develop this website yourself? Please reply back as I’m trying to create my own personal website and would love to find out where you got this from or just what the theme is named. Kudos!

  8. Wonderful story, reckoned we could combine a couple of unrelated information, nevertheless actually really worth taking a appear, whoa did one learn about Mid East has got more problerms too

  9. very couple of websites that occur to be comprehensive below, from our point of view are undoubtedly very well worth checking out

  10. Thank you for the post. I will definitely return.

  11. I truly love your blog.. Great colors & theme. Did you make this website yourself? Please reply back as I’m wanting to create my very own blog and want to find out where you got this from or what the theme is called. Kudos.

  12. very handful of internet websites that transpire to be detailed below, from our point of view are undoubtedly properly worth checking out

  13. In accordance to my knowledge using this Chaturbate hack
    plan from earlier month, more often than not the tokens can be accessible to my account in lower
    than 5 minutes.

  14. This site was… how do you say it? Relevant!! Finally I’ve found something which helped me. Thank you.

  15. payday loans lenders http://paydayloansdwt.com/ – payday loans companies installment payday loans payday loans direct lender top payday loans

  16. no credit payday loan http://paydayloanrgh.com/ – online payday loan companies advance payday loan fast online payday loan online payday loan lenders

  17. Thanks for expressing your ideas. I’d also like to mention that video games have been actually evolving. Modern tools and innovative developments have made it easier to create practical and interactive games. These kinds of entertainment games were not really sensible when the actual concept was first of all being attempted. Just like other styles of technological know-how, video games also have had to advance via many years. This is testimony on the fast growth of video games.

  18. below youll locate the link to some sites that we feel you should visit

  19. Excellent web site you have here.. It’s hard to find excellent writing like yours these days. I seriously appreciate individuals like you! Take care!!

  20. Arimidex http://diclofenacvoltarenax.com/ – AyurSlim Xenical Alesse Careprost

  21. Every once inside a when we pick out blogs that we read. Listed beneath would be the latest web pages that we select

  22. This is a very good tip particularly to those fresh to the blogosphere. Simple but very precise info… Thanks for sharing this one. A must read post!

  23. I’ll right away clutch your rss feed as I can not to find your email subscription link or
    e-newsletter service. Do you have any? Kindly permit me recognise in order that I may
    just subscribe. Thanks.

  24. Wow, wonderful blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is excellent, let alone the content!. Thanks For Your article about sex.

  25. Whats up. Very cool blog!! Man.. Excellent.. Amazing.. I all bookmark your website and take the feeds alsoI am glad to find numerous useful information here in the post. Thank you for sharing

  26. Excellent article. I will be facing many of these issues as well..

  27. There is definately a great deal to learn about this issue. I really like all the points you ave made.

  28. I see something really interesting about your web blog so I saved to my bookmarks.

  29. very handful of web-sites that transpire to become comprehensive beneath, from our point of view are undoubtedly very well worth checking out

  30. me. Is anyone else having this problem or is it a problem on my end?

  31. payday loan no faxing http://paydayloanjyd.com/ – payday loan locations payday loan application how do i get out of payday loan debt payday loan no checks

  32. info for a very lengthy time. Thank you and good luck.

  33. Howdy just wanted to give you a quick heads up. The text in your article seem to be running off the screen in Safari.
    I’m not sure if this is a formatting issue or something to do with web browser compatibility
    but I thought I’d post to let you know. The style and design look
    great though! Hope you get the issue solved soon. Many thanks

  34. one of our visitors not long ago encouraged the following website

  35. although web sites we backlink to beneath are considerably not related to ours, we feel they’re basically really worth a go via, so have a look

  36. It is laborious to search out knowledgeable people on this matter, but you sound like you recognize what you are speaking about! Thanks

  37. bad credit payday loans http://paydayloansuyi.com/ – cash till payday loans payday loans no faxing faxless payday loans payday loans review

  38. You’ve made some good points there. I looked on the web for additional information about the issue
    and found most individuals will go along with your views on this web site.

  39. Admiring the time and energy you put into your website and in depth information you offer.
    It’s awesome to come across a blog every once in a
    while that isn’t the same out of date rehashed information. Wonderful read!
    I’ve saved your site and I’m including your RSS feeds to my Google account.

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