go to  ForumEasy.com   
JavaPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » Java Deploying » Maven -- Configure
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: Maven -- Configure
Alex_Raj
member
offline   
 
posts: 99
joined: 05/16/2006
from: San Jose, CA
  posted on: 10/10/2019 12:50:08 AM    Edit  |   Quote  |   Report 
Maven -- Configure
Maven configuration occurs at 3 levels:

  • Project - most static configuration occurs in pom.xml
  • Installation - this is configuration added once for a Maven installation
  • User - this is configuration specific to a particular user in ${user.home}/.m2/settings.xml

    The separation is quite clear - the project defines information that applies to the project, no matter who is building it, while the others both define settings for the current environment.
  •  Profile | Reply Points Earned: 0
    Alex_Raj
    member
    offline   
     
    posts: 99
    joined: 05/16/2006
    from: San Jose, CA
      posted on: 10/10/2019 12:50:57 AM    Edit  |   Quote  |   Report 
    How maven dependency works? or Where do the libraries come from?

    With maven, project finds it's denpedent libraries in the following order:

  • First locally look at location ${user.home}/.m2/repository/
  • If not found, then remotely download from http://repo.maven.apache.org/maven2/

  •  Profile | Reply Points Earned: 0
    Alex_Raj
    member
    offline   
     
    posts: 99
    joined: 05/16/2006
    from: San Jose, CA
      posted on: 10/10/2019 12:52:27 AM    Edit  |   Quote  |   Report 
    Change default settings

    Change default local repository in ${user.home}/.m2/settings.xml
    <settings>
      ...
      <localRepository>/path/to/local/repo/</localRepository>
      ...
    </settings>
    


    Add a proxy or mirror to remote repository in ${user.home}/.m2/settings.xml
    <settings>
      ...
      <localRepository/>
      ...
      <mirrors>
        <mirror>
          <id>internal-repository</id>
          <name>Maven Repository Manager running on repo.mycompany.com</name>
          <url>http://repo.mycompany.com/nexus/content/public</url>
          <!--This * sends everything else to the above reposiory -->
          <mirrorOf>*</mirrorOf>
        </mirror>
      </mirrors>
    
      <profiles>
        <profile>
        ...
        </profile>
    	
        <profile>
        ...
        </profile>
      </profiles>
     
    
    </settings>


    Another advanced example
    <settings>
      ...
      <mirrors>
        <mirror>
          <id>internal-repository</id>
          <name>Maven Repository Manager running on repo.mycompany.com</name>
          <url>http://repo.mycompany.com/proxy</url>
          <mirrorOf>external:*,!foo</mirrorOf>
        </mirror>
        <mirror>
          <id>foo-repository</id>
          <name>Foo</name>
          <url>http://repo.mycompany.com/foo</url>
          <mirrorOf>foo</mirrorOf>
        </mirror>
      </mirrors>
      ...
    </settings>
    


     Profile | Reply Points Earned: 0

     
    Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.