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. I in addition to my buddies happened to be viewing the nice advice from your web blog then instantly developed a horrible suspicion I never expressed respect to the web blog owner for those techniques. Most of the ladies came so warmed to learn all of them and now have seriously been having fun with those things. Appreciation for simply being so thoughtful as well as for considering varieties of wonderful subjects most people are really desperate to know about. My personal honest apologies for not expressing appreciation to you sooner.

  2. Can I simply say what a relief to uncover an individual who genuinely understands what they’re talking about online. You definitely know how to bring a problem to light and make it important. More and more people need to check this out and understand this side of the story. It’s surprising you aren’t more popular given that you surely possess the gift.

  3. Good write-up. I certainly appreciate this website. Thanks!

  4. bookmarked!!, I like your web site!

  5. that may be the finish of this report. Right here youll come across some web-sites that we think youll enjoy, just click the links over

  6. usually posts some extremely interesting stuff like this. If you are new to this site

  7. the time to read or pay a visit to the content material or sites we’ve linked to below the

  8. Here is a great Blog You might Uncover Fascinating that we Encourage You

  9. usually posts some incredibly exciting stuff like this. If youre new to this site

  10. the time to study or pay a visit to the content material or web sites we’ve linked to beneath the

  11. very handful of internet websites that occur to become detailed beneath, from our point of view are undoubtedly effectively really worth checking out

  12. Pretty! This has been a really wonderful article. Thanks for supplying these details.

  13. Next time I read a blog, Hopefully it doesn’t disappoint me just as much as this particular one. I mean, I know it was my choice to read, nonetheless I truly believed you’d have something interesting to talk about. All I hear is a bunch of moaning about something you could possibly fix if you weren’t too busy seeking attention.

  14. we could greatly benefit from each other. If you might be interested feel free to send me an

  15. payday loans quick and simple http://quickloansrgl.com/ – quick cash loans over the phone quick cash loans in las pinas quick cash loans cda quick cash loans south kingshighway

  16. Excellent post. I absolutely love this website. Keep writing!

  17. I have to thank you for the efforts you’ve put in writing this blog. I’m hoping to check out the same high-grade content by you later on as well. In fact, your creative writing abilities has encouraged me to get my very own site now ;)

  18. I really liked your blog article.Really looking forward to read more.

  19. here are some hyperlinks to internet sites that we link to mainly because we assume they may be worth visiting

  20. You have got some real insight. Why not hold some sort of contest for your readers?

  21. Good info. Lucky me I found your blog by chance (stumbleupon). I have book marked it for later.

  22. You ought to be a part of a contest for one of the most useful sites on the net. I am going to highly recommend this web site!

  23. fast cash bad credit personal loans http://fastcashloansvfl.com/ – payday loans fast online fast payday loans crestview florida fast payday loans for bad credit fast cash loans no paperwork

  24. Wow, great post.Really thank you! Great.

  25. Can I simply just say what a relief to uncover someone that really knows what they are talking about on the net. You certainly understand how to bring a problem to light and make it important. More and more people ought to read this and understand this side of the story. I was surprised that you are not more popular since you definitely have the gift.

  26. Thanks a lot for the blog.Really thank you! Great.

  27. Spot on with this write-up, I honestly feel this site needs a great deal more attention. I’ll probably be returning to read more, thanks for the info.

  28. I want to show my thanks to this writer for bailing me out of this particular crisis. As a result of browsing throughout the world-wide-web and finding opinions which are not beneficial, I believed my life was done. Existing minus the approaches to the difficulties you’ve sorted out by means of your good post is a serious case, as well as ones which might have badly affected my career if I hadn’t discovered your blog. The competence and kindness in touching all the stuff was invaluable. I don’t know what I would have done if I hadn’t encountered such a solution like this. I can also now relish my future. Thanks a lot very much for the specialized and results-oriented help. I won’t think twice to endorse your site to anyone who needs support on this situation.

  29. It as nearly impossible to find educated people on this topic, however, you seem like you know what you are talking about! Thanks

  30. Great information. Lucky me I ran across your website by chance (stumbleupon). I have saved it for later.

  31. The next time I read a blog, I hope that it won’t fail me just as much as this particular one. I mean, I know it was my choice to read, however I really thought you’d have something useful to talk about. All I hear is a bunch of complaining about something you can fix if you weren’t too busy looking for attention.

  32. You completed a number of first rate points near. I appeared by the internet for the problem and found the majority folks will go along with along with your website.

  33. Wonderful blog! I found it while searching on Yahoo News.

  34. although web-sites we backlink to below are considerably not connected to ours, we really feel they are really worth a go by means of, so possess a look

  35. Hello there! This article couldn’t be written any better! Reading through this post reminds me of my previous roommate! He continually kept preaching about this. I am going to send this information to him. Pretty sure he will have a great read. I appreciate you for sharing!

  36. This is a topic which is close to my heart… Take care! Exactly where can I find the contact details for questions?

  37. I?ve read several excellent stuff here. Definitely worth bookmarking for revisiting. I wonder how so much effort you put to make one of these fantastic informative website.

  38. you got a very excellent website, Glad I observed it through yahoo.

  39. online payday loan in colorado http://onlineloansdhx.com/ – louisiana law on online payday loans online payday loan maryland payday loans missouri online cash loan online fast

  40. This site truly has all the information and facts I wanted about this subject and didn’t know who to ask.

  41. Well I really liked studying it. This post procured by you is very effective for proper planning.

  42. I’m impressed, I must say. Seldom do I encounter a blog that’s equally educative and amusing, and without a doubt, you’ve hit the nail on the head. The problem is something too few people are speaking intelligently about. I am very happy that I stumbled across this in my search for something relating to this.

  43. ygjuiw pharmaci online pharmacy online prescription cheap canadian pharmacy
    drugstore products hhpwst drugs pharmacy online prescription pharmacy
    canada prescriptions online

  44. Really informative blog article.Really looking forward to read more. Really Great.

  45. May I simply just say what a comfort to uncover somebody who truly understands what they’re talking about over the internet. You definitely understand how to bring an issue to light and make it important. A lot more people ought to look at this and understand this side of your story. I was surprised you are not more popular since you certainly have the gift.

  46. Wow, great blog post.Thanks Again. Really Cool.

  47. payday loans in nc http://paydayloansyja.com/ – same payday loans payday loans san diego no credit check payday loans online payday loans yes

  48. Respect to author, some fantastic entropy.

  49. I needed to thank you for this wonderful read!! I definitely loved every little bit of it. I have you book marked to look at new stuff you post…

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