Over a million developers have joined DZone.

Populate Your Maven Repo With Mule ESB Libraries

· Integration Zone

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and dPaaS could cost you down the road. Brought to you in partnership with Liaison Technologies.

When you build applications based on Mule EE (Enterprise Edition) and you are using Maven to build your projects, you will notice you have dependencies to libraries that are not available in the public Maven repos. To add these libraries to your local maven repo the Mule distribution comes with a script ‘populate_m2_repo’ which is described here how to use it.

Now that is okay if you are the only developer and you are running your continuous integration on your local machine. In my case we are using Artifactory as our company Maven repository and also our build server is using it as the Maven repo. So what I wanted was not to populate my local repository but the Artifactory instance with all Mule libraries. To do so I did two things:

  • First make sure that Maven is authorised to add libraries to Artifactory. You can do this by adding the following to your settings.xml:
  • <servers>
  • Second step is to modify the original ‘populate_m2_repo.groovy’ script. Replace the following line:
    "-Dversion=${version}", "-Dpackaging=pom", 
    "-Durl=http://localhost:8080/artifactory/libs-release-local" ])
    And do the same for the line:
    def args = ["install:install-file", 
    by replacing it with:
    def args = ["deploy:deploy-file", 
    "-Durl=http://localhost:8080/artifactory/libs-release-local" ]
    Now you can run the script with:
    ./populate_m2_repo bla
    As you can see it doesn’t really matter what you supply as M2_REPO_HOME here because the libraries are uploaded to Artifactory anyway.

    If you want you can replace the hardcoded url for Artifactory in the script with the supplied parameter but in my case this solution was sufficient :-)

Discover the unprecedented possibilities and challenges, created by today’s fast paced data climate and why your current integration solution is not enough, brought to you in partnership with Liaison Technologies.


Published at DZone with permission of Pascal Alma, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}