How to download SNAPSHOT version from maven SNAPSHOT repository?

前端 未结 4 442
慢半拍i
慢半拍i 2020-12-08 06:48

So I have a project and I do regular releases to maven without a problem. I now want to make available a SNAPSHOT version of this project. So I do \'mvn clean deploy\'. Ever

相关标签:
4条回答
  • 2020-12-08 07:14

    For the sake of completeness, I would like to add that it is also possible by modifying the pom.xml of a project, simply add

     <repositories>
        <repository>
          <id>oss.sonatype.org-snapshot</id>
          <url>http://oss.sonatype.org/content/repositories/snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    

    to your list of repositories.

    In my opinion, this is a better solution than modifying ~/.m2/settings.xml. The pom.xml file will also be available for other project participants through Git and allow them to download the snapshots as well.

    Source: this answer

    0 讨论(0)
  • 2020-12-08 07:21

    Just add this to your ~/.m2/settings.xml:

    <profiles>
      <profile>
         <id>allow-snapshots</id>
            <activation><activeByDefault>true</activeByDefault></activation>
         <repositories>
           <repository>
             <id>snapshots-repo</id>
             <url>https://oss.sonatype.org/content/repositories/snapshots</url>
             <releases><enabled>false</enabled></releases>
             <snapshots><enabled>true</enabled></snapshots>
           </repository>
         </repositories>
       </profile>
    </profiles>
    
    0 讨论(0)
  • 2020-12-08 07:22

    http://maven.40175.n5.nabble.com/How-to-enable-SNAPSHOT-td130614.html

    Are you configured to enable snapshots?

    0 讨论(0)
  • 2020-12-08 07:24

    You can enable snapshots in repository config (~/.m2/settings.xml):

    <settings>
        <profiles>
            <profile>
              <repositories>
                <repository>
                  <snapshots>                  <<<<<<<<<<<
                    <enabled>true</enabled>    << ADD THIS
                  </snapshots>                 <<<<<<<<<<<
      . . .
    </settings>
    

    See maven.apache.org/settings.html#Repositories for more properties.

    0 讨论(0)
提交回复
热议问题