2023-03-12
原文作者:w3cschool 原文地址:https://www.w3cschool.cn/intellij_idea_tutorial/intellij_idea_tutorial-clvf3h50.html
  • 在 IntelliJ IDEA 上调用 profile简单,如下图勾选对应的复选框即可,可以多选。

202303121114175481.pngIntelliJ IDEA 配合 Maven 的一些技巧

  • 只使用 aliyun 仓库可以这样配置 settings.xml
    
      
        
         
       <?xml version="1.0" encoding="UTF-8"?>
      
        
      
        
      
        
         
       <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      
        
      
        
         
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
        
      
        
         
                 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
      
        
      
        
      
        
         
           <localRepository>D:\maven\my_local_repository</localRepository>
      
        
      
        
      
        
         
           <pluginGroups>
      
        
      
        
         
           </pluginGroups>
      
        
      
        
      
        
         
           <proxies>
      
        
      
        
         
           </proxies>
      
        
      
        
      
        
         
           <profiles>
      
        
      
        
         
               <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>
      
        
      
        
         
                       </repository>
      
        
      
        
         
                   </repositories>
      
        
      
        
         
                   <pluginRepositories>
      
        
      
        
         
                       <pluginRepository>
      
        
      
        
         
                           <id>aliyun</id>
      
        
      
        
         
                           <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      
        
      
        
         
                           <releases>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </releases>
      
        
      
        
         
                           <snapshots>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </snapshots>
      
        
      
        
         
                       </pluginRepository>
      
        
      
        
         
                   </pluginRepositories>
      
        
      
        
         
               </profile>
      
        
      
        
         
           </profiles>
      
        
      
        
      
        
         
           <activeProfiles>
      
        
      
        
         
               <activeProfile>aliyun</activeProfile>
      
        
      
        
         
           </activeProfiles>
      
        
      
        
      
        
         
       </settings>
  • 使用 nexus + aliyun 仓库可以这样配置 settings.xml
    
      
        
         
       <?xml version="1.0" encoding="UTF-8"?>
      
        
      
        
      
        
         
       <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      
        
      
        
         
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
        
      
        
         
                 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
      
        
      
        
      
        
         
           <localRepository>D:\maven\my_local_repository</localRepository>
      
        
      
        
      
        
         
           <pluginGroups>
      
        
      
        
         
           </pluginGroups>
      
        
      
        
      
        
         
           <proxies>
      
        
      
        
         
           </proxies>
      
        
      
        
      
        
         
           <profiles>
      
        
      
        
         
               <profile>
      
        
      
        
         
                   <id>nexus</id>
      
        
      
        
         
                   <repositories>
      
        
      
        
         
                       <repository>
      
        
      
        
         
                           <id>nexus</id>
      
        
      
        
         
                           <url>http://192.168.1.73:8081/repository/maven-public/</url>
      
        
      
        
         
                           <releases>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </releases>
      
        
      
        
         
                           <snapshots>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </snapshots>
      
        
      
        
         
                       </repository>
      
        
      
        
         
                   </repositories>
      
        
      
        
         
                   <pluginRepositories>
      
        
      
        
         
                       <pluginRepository>
      
        
      
        
         
                           <id>nexus</id>
      
        
      
        
         
                           <url>http://192.168.1.73:8081/repository/maven-public/</url>
      
        
      
        
         
                           <releases>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </releases>
      
        
      
        
         
                           <snapshots>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </snapshots>
      
        
      
        
         
                       </pluginRepository>
      
        
      
        
         
                   </pluginRepositories>
      
        
      
        
         
               </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>
      
        
      
        
         
                       </repository>
      
        
      
        
         
                   </repositories>
      
        
      
        
         
                   <pluginRepositories>
      
        
      
        
         
                       <pluginRepository>
      
        
      
        
         
                           <id>aliyun</id>
      
        
      
        
         
                           <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      
        
      
        
         
                           <releases>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </releases>
      
        
      
        
         
                           <snapshots>
      
        
      
        
         
                               <enabled>true</enabled>
      
        
      
        
         
                           </snapshots>
      
        
      
        
         
                       </pluginRepository>
      
        
      
        
         
                   </pluginRepositories>
      
        
      
        
         
               </profile>
      
        
      
        
         
           </profiles>
      
        
      
        
      
        
         
           <activeProfiles>
      
        
      
        
         
               <activeProfile>nexus</activeProfile>
      
        
      
        
         
           </activeProfiles>
      
        
      
        
      
        
         
       </settings>
阅读全文