Maven使用命令mvn clean install 不從遠程倉庫拉取jar文件


現象描述:

    項目是多模塊的,使用mvn clean install 想編譯一下。發現不從公司的私有倉庫拉取文件。導致編譯不通過。第一時間覺的是遠程倉庫配置的有問題。所以去找到setting.xml文件查看。但是發現遠程倉庫配置是正確的呀。到最后才發現是activeProfiles的問題。把這個注釋打開就好了。真是.....

<!--這個之前是注釋掉的-->
<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>

部分配置如下:

<profile>
      <id>jdk-1.8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
      </activation>

      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
    </profile>
    
    <profile>
      <id>nexus</id>
      <repositories>
        <repository>
          <id>nexus</id>
          <name>Nexus</name>
          <url>http://nexus.xxx.xxx/repository/public</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus</id>
          <name>Nexus</name>
          <url>http://nexus.xxx.xxx/repository/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

<activeProfiles>
   <activeProfile>nexus</activeProfile>
</activeProfiles>

 

 

 

 

參考:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM