Adding maven nexus repo to my pom.xml

前端 未结 6 1169
死守一世寂寞
死守一世寂寞 2020-12-08 00:30

I have installed nexus on my local machine. I want my pom file to point to this repo. How can I add my custom repository to my pom.xml file?

6条回答
  •  攒了一身酷
    2020-12-08 01:12

    First of all I can highly recommend reading the Nexus book. It will explain the benefits of using a Maven repository manager.

    There is a section on how to configure your Maven build to use Nexus:

    • http://www.sonatype.com/books/nexus-book/reference/config.html

    This leads me to question why you altering your POM file? I suspect what you really want to do is setup Nexus as a remote repository mirror. This is done in your Maven settings file.

    The following tells Maven use Nexus as your default repository (Instead of Maven Central)

    
      ..
      ..
      
        
          nexus
          http://localhost:8081/nexus/content/groups/public
          central
        
      
    

    This is desired behaviour since your Nexus repository is configured to cache artifacts retrieved from Central (which is good for build performance).

    Note:

    • The "public" repository group could include other repositories proxied by your Nexus instance (Not just Maven Central). You probabily want this behaviour, as it centralizes all repository management. It just makes your build less portable for people outside of your organization.

提交回复
热议问题