{"id":16,"date":"2014-01-02T12:13:17","date_gmt":"2014-01-02T12:13:17","guid":{"rendered":"http:\/\/www.nedlowe.co.uk\/blog\/?p=16"},"modified":"2014-01-02T12:15:36","modified_gmt":"2014-01-02T12:15:36","slug":"sharing-resources-between-maven-modules","status":"publish","type":"post","link":"https:\/\/www.nedlowe.co.uk\/blog\/?p=16","title":{"rendered":"Sharing Resources between Maven modules"},"content":{"rendered":"<p>(Recovered from my old Blog).<\/p>\n<p>I needed to share resources between modules in a multi-module Maven project. The resources in question are configuration data files which are converted into objects via XStream (plus some Spring Bean configuration files). The reason they need to be shared is for instantiation within module-specific JUnit tests.<\/p>\n<p>After some thinking and Googling around, I think I have come up with the \u2018cleanest\u2019 structure. My first thought was to put them into the parent module, but after messing around with configuration, I began to realise this was a bad idea.<\/p>\n<p>My new solutions goes like this:<\/p>\n<ul>\n<li>Create a new sub-module (called config or whatever)<\/li>\n<li>Put a dependency to this new module in the pom.xml for all other modules<\/li>\n<li>Even though these are test resources, put them in \/src\/main\/resources so they are packaged into the jar (or obviously change the default packaging so it includes the \/src\/test\/resources)<\/li>\n<\/ul>\n<p>Quite clean I think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(Recovered from my old Blog). I needed to share resources between modules in a multi-module Maven project. The resources in question are configuration data files which are converted into objects via XStream (plus some Spring Bean configuration files). The reason they need to be shared is for instantiation within module-specific JUnit tests. After some thinking [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7QqxF-g","jetpack-related-posts":[{"id":41,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=41","url_meta":{"origin":16,"position":0},"title":"Dummy Files in Unit Tests","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). Let\u2019s say that you have an application which accepts a filepath as part of its interface. When unit testing, you may have some dummy files which you use to test the interface. However, getting the full path of these test files can be a pain.\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":88,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=88","url_meta":{"origin":16,"position":1},"title":"virtualenvwrapper installation on MacOS in 2018","date":"February 26, 2018","format":false,"excerpt":"This post is to try and save someone the 15 minutes I stupidly wasted! If you installed Python via Homebrew, it now names the python executable python2 (and similarly pip becomes pip2). When you then try to install\u00a0virtualenvwrapper you get the error: \/usr\/bin\/python: No module named virtualenvwrapper virtualenvwrapper.sh: There was\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":33,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=33","url_meta":{"origin":16,"position":2},"title":"Spring Security 3 Setup","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). Getting Spring Security setup only involves a few steps, but it can be confusing to work out exactly what they are \u2013 especially since almost all documentation refers to Spring Security 2, and there are a couple of differences. The first thing to do is\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":31,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=31","url_meta":{"origin":16,"position":3},"title":"SiteMesh with Spring MVC","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). SiteMesh is an open source framework that implements the Decorator pattern. It essentially takes the output stream from a web application, and adds elements to (\u2019decorates\u2019) it. Why would we want that? Put simply, it is an incredibly clean way of adding headers\/footers\/anything, with the\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":35,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=35","url_meta":{"origin":16,"position":4},"title":"Log4j and Tomcat issue","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). Quick one \u2013 I had this issue today so wanted to record it for posterity. Tomcat can get confused if WEB-INF\/lib contains the log4j jar, with initialisation errors such as: java.lang.ClassNotFoundException: org.apache.log4j.Category You might not even have directly included it \u2013 it might be included\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=14","url_meta":{"origin":16,"position":5},"title":"Injecting Resources into Spring Beans","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). This is mentioned in passing in the Spring documentation \u2013 but to highlight: Spring will automatically convert a String in a bean definition into a Resource if required. If the target Resource is a specific class (e.g. UrlResource) then the passed in string must match\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/16"}],"collection":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16"}],"version-history":[{"count":2,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/16\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}