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. that is the finish of this article. Here you will discover some web pages that we feel youll enjoy, just click the links over

  2. Way cool! Some extremely valid points! I appreciate you penning this post and also the rest of the website is very good.

  3. Pretty! This was an incredibly wonderful post. Thank you for providing these details.

  4. Great article. I am going through many of these issues as well..

  5. Wow! Thank you! I constantly needed to write on my site something like that. Can I take a portion of your post to my site?

  6. we came across a cool site that you just could get pleasure from. Take a search if you want

  7. I really liked your blog.Really looking forward to read more. Awesome.

  8. Aw, this was an extremely nice post. Spending some time and actual effort to create a great article… but what can I say… I hesitate a whole lot and don’t manage to get nearly anything done.

  9. Cardura http://meloxicammobicxn.com/ – Malegra FXT plus Kamagra Oral Jelly Cardura Mentat

  10. Way cool! Some extremely valid points! I appreciate you writing this write-up and also the rest of the website is also really good.

  11. I quite like looking through a post that can make men and women think. Also, thanks for permitting me to comment.

  12. This is my first time pay a visit at here and i am truly happy to read everthing at one
    place.

  13. Greetings! Very helpful advice in this particular post! It’s the little changes that produce the greatest changes. Many thanks for sharing!

  14. Pretty! This has been an extremely wonderful post. Thank you for supplying this info.

  15. essaywriting service http://essaywritersrpl.com/ – professional essay help what is the best online essay writing service good customer service essay sat essay help

  16. Howdy! This blog post could not be written any better! Looking through this post reminds me of my previous roommate! He always kept talking about this. I most certainly will forward this article to him. Fairly certain he will have a very good read. Thanks for sharing!

  17. that may be the end of this report. Right here youll locate some web pages that we think youll enjoy, just click the hyperlinks over

  18. Howdy! This post could not be written any better! Looking through this article reminds me of my previous roommate! He constantly kept preaching about this. I most certainly will forward this article to him. Fairly certain he’s going to have a great read. I appreciate you for sharing!

  19. although websites we backlink to below are considerably not associated to ours, we really feel they may be basically really worth a go by way of, so possess a look

  20. Magnificent goods from you, man. I have be aware your

  21. that is the end of this write-up. Right here youll come across some websites that we think youll enjoy, just click the hyperlinks over

  22. Sites of interest we’ve a link to

  23. After looking over a number of the blog posts on your blog, I truly appreciate your way of blogging. I added it to my bookmark website list and will be checking back in the near future. Please check out my website too and let me know what you think.

  24. one of our guests not too long ago recommended the following website

  25. Here are some of the internet sites we suggest for our visitors

  26. Hi there, I think your web site could possibly be having web browser compatibility problems. When I look at your blog in Safari, it looks fine however when opening in IE, it has some overlapping issues. I just wanted to provide you with a quick heads up! Apart from that, great website.

  27. Pretty! This has been an incredibly wonderful article. Thank you for supplying this information.

  28. Very good info. Lucky me I found your blog by accident (stumbleupon). I’ve book-marked it for later.

  29. Everything is very open with a very clear explanation of the challenges. It was really informative. Your site is useful. Thank you for sharing.

  30. Pretty! This was a really wonderful article. Thank you for supplying these details.

  31. below you will uncover the link to some internet sites that we think you need to visit

  32. Sites of interest we have a link to

  33. dissertations writing services http://dissertationyjx.com/ – dissertation database phd dissertation dissertations and theses dissertation writing coach

  34. Sites of interest we have a link to

  35. term papers custom http://termpapernfu.com/ – term paper writing service term paper service buying a term paper buy custom term papers

  36. Hi, I do think this is a great website. I stumbledupon it ;) I am going to return once again since i have book marked it. Money and freedom is the greatest way to change, may you be rich and continue to help others.

  37. This blog was… how do I say it? Relevant!! Finally I’ve found something that helped me. Many thanks.

  38. Cod Only Bentyl Where To Purchase http://buycialisuss.com – cialis from canada Propecia La Web Cialis Propecia Dosage Acne

  39. Good post. I learn something totally new and challenging on blogs I stumbleupon on a daily basis. It’s always exciting to read through articles from other authors and use a little something from other web sites.

  40. thesis http://thesissgj.com/ – research methodology thesis thesis writing tips help me write a thesis statement thesis statistics help

  41. here are some hyperlinks to websites that we link to simply because we assume they may be worth visiting

  42. It’s nearly impossible to find educated people for this topic, but you sound like you know what you’re talking about! Thanks

  43. I think this is a real great article.Thanks Again.

  44. An interesting discussion is definitely worth comment. I think that you ought to write more about this subject, it may not be a taboo subject but usually people don’t discuss such issues. To the next! All the best!

  45. I really love your website.. Pleasant colors & theme. Did you create this web site yourself? Please reply back as I’m planning to create my very own blog and want to learn where you got this from or what the theme is called. Cheers!

  46. Very good article! We are linking to this particularly great article on our website. Keep up the good writing.

  47. the time to study or check out the material or web sites we have linked to beneath the

  48. just beneath, are a lot of absolutely not related web pages to ours, even so, they are surely really worth going over

  49. Good post. I learn something totally new and challenging on blogs I stumbleupon on a daily basis. It’s always helpful to read through content from other authors and practice a little something from their web sites.

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