How does maven configure multiple images, one of which is used by multiple different projects?

scene

  1. in the company, do the company"s project A, use the company"s private server.
  2. when you are at home, if you want to play with other project B, you should go to setting.xml to change the image setting to a public warehouse
  3. .

does maven provide any function to set the remote warehouse address for a project separately? when I was working on the A project in the company, he went to the company"s private server to download the jar package. When you are at home, you can"t connect to the company"s intranet, so use a public warehouse (such as Aliyun, etc.).
I don"t know how to implement it.

<mirrors>
    <!-- <mirror>
      <id>releases</id>
      <mirrorOf>central</mirrorOf>
      <name>Team Nexus Repository</name>
      <url>http://192.168.0.222:8081/nexus/content/groups/public</url>
    </mirror> -->
    <mirror>
      <id>aliyun</id>
      <name>aliyun-public</name>
      <mirrorOf>central</mirrorOf>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
</mirrors>
Mar.04,2021

this can be configured with multiple repositories in profiles. If a dependency is not found in one of the repositories, it will be found in the next warehouse in turn. To set the enabled warehouse in activeProfiles

<profiles>

      <profile>
          <id>sonar</id>
          <properties>
              <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
              <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
              <sonar.jdbc.username>sonar</sonar.jdbc.username>
              <sonar.jdbc.password>sonar@pw</sonar.jdbc.password>
              <sonar.host.url>http://xx.xx.xx.xx:9000/</sonar.host.url> <!-- Sonar -->
          </properties>
      </profile>

      <profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
                    <!-- <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> 
                        </snapshots> -->
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
</profiles>
<activeProfiles>
    <activeProfile>sonar</activeProfile>
    <activeProfile>aliyun</activeProfile>
</activeProfiles>

isn't it possible to have different maven configurations for different projects? why don't you just make a copy of the maven package and make the whole two maven?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b9d6c7-2f38c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b9d6c7-2f38c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?