DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Configurable Feign Client Retry With Reusable Library and DRY
  • Using Lombok Library With JDK 23
  • OpenAPI From Code With Spring and Java: A Recipe for Your CI
  • C/C++ Is Where Vulnerability Programs Go to Guess

Trending

  • A Deep Dive into Tracing Agentic Workflows (Part 1)
  • Building a Zero-Cost Approval Workflow With AWS Lambda Durable Functions
  • Bringing Intelligence Closer to the Source: Why Real-Time Processing is the Heart of Edge AI
  • Feature Flag Debt: Performance Impact in Enterprise Applications
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Populate Your Maven Repo With Mule ESB Libraries

Populate Your Maven Repo With Mule ESB Libraries

By 
$$anonymous$$ user avatar
$$anonymous$$
·
Dec. 04, 13 · Interview
Likes (0)
Comment
Save
Tweet
Share
10.8K Views

Join the DZone community and get the full member experience.

Join For Free

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>
      <server>
        <id>artifactory</id>
        <username>admin</username>
        <password>password</password>
      </server>
    </servers>
  • second step is to modify the original ‘populate_m2_repo.groovy’ script. replace the following line:
    mvn(["install:install-file",
    "-dgroupid=${project.groupid}", 
    "-dartifactid=${project.artifactid}", 
    "-dversion=${version}", "-dpackaging=pom", 
    "-dfile=${localpom.canonicalpath}"])
    with
    mvn(["deploy:deploy-file", 
    "-dgroupid=${project.groupid}", 
    "-dartifactid=${project.artifactid}", 
    "-dversion=${version}", 
    "-dpackaging=pom", 
    "-dfile=${localpom.canonicalpath}", 
    "-drepositoryid=arti", 
    "-durl=http://localhost:8080/artifactory/libs-release-local" ])
    and do the same for the line:
    def args = ["install:install-file", 
    "-dgroupid=${pomprops.groupid}", 
    "-dartifactid=${pomprops.artifactid}", 
    "-dversion=${pomprops.version}", 
    "-dpackaging=jar", 
    "-dfile=${f.canonicalpath}", 
    "-dpomfile=${localpom.canonicalpath}"]
    by replacing it with:
    def args = ["deploy:deploy-file", 
    "-dgroupid=${pomprops.groupid}", 
    "-dartifactid=${pomprops.artifactid}", 
    "-dversion=${pomprops.version}", 
    "-dpackaging=jar", 
    "-dfile=${f.canonicalpath}", 
    "-dpomfile=${localpom.canonicalpath}", 
    "-drepositoryid=arti", 
    "-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 :-)

Apache Maven Library Enterprise service bus

Published at DZone with permission of $$anonymous$$. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Configurable Feign Client Retry With Reusable Library and DRY
  • Using Lombok Library With JDK 23
  • OpenAPI From Code With Spring and Java: A Recipe for Your CI
  • C/C++ Is Where Vulnerability Programs Go to Guess

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook