maven 不会更改本地存储库中的快照 jar 文件

maven does not change the snapshot jar file in local repository

我们成功配置了 jfrog artifactory 并创建了一个 pom.xml 来构建我们的基本 jar 文件并将其作为快照部署到其中。然后我们配置另一个项目以从存储库中获取这些 jar 文件并且它也成功了,然后我们尝试更改基本库并再次将其部署为相同的快照名称,并且它确实正确但是当我们想要再次获取这些库时,maven不会更改本地存储库中的基本库,除非我们更改快照的版本但我们不想这样做。

部署pom.xml配置文件

<plugin>
                <groupId>org.jfrog.buildinfo</groupId>
                <artifactId>artifactory-maven-plugin</artifactId>
                <version>2.2.2</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>build-info</id>
                        <goals>
                            <goal>publish</goal>
                        </goals>
                        <configuration>
                            <deployProperties>
                                <gradle>awesome</gradle>
                            </deployProperties>
                            <artifactory>
                                <includeEnvVars>true</includeEnvVars>
                                <timeoutSec>60</timeoutSec>
                                <propertiesFile>publish.properties</propertiesFile>
                            </artifactory>
                            <publisher>
                                <contextUrl>{{ARTIFACTORY_CONTEXT_URL|"http://tls.local:9081/artifactory"}}</contextUrl>
                                <username>admin</username>
                                <password>AP5PqkrxgwKVMBeY6wxPYr66R3M</password>
                                <excludePatterns>*-tests.jar</excludePatterns>
                                <repoKey>libs-release-local</repoKey>
                                <snapshotRepoKey>libs-snapshot-local</snapshotRepoKey>
                            </publisher>
                            <buildInfo>
                                <buildName>plugin-demo</buildName>
                                <buildNumber>{{DRONE_BUILD_NUMBER|TRAVIS_BUILD_NUMBER|CI_BUILD_NUMBER|BUILD_NUMBER}}
                                </buildNumber>
                                <buildUrl>{{DRONE_BUILD_URL|CI_BUILD_URL|BUILD_URL}}</buildUrl>
                            </buildInfo>
                            <licenses>
                                <autoDiscover>true</autoDiscover>
                                <includePublishedArtifacts>false</includePublishedArtifacts>
                                <runChecks>true</runChecks>
                                <scopes>compile,runtime</scopes>
                                <violationRecipients>build@organisation.com</violationRecipients>
                            </licenses>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                </configuration>
            </plugin>

第三方pom.xml配置文件:

 <repository>           
      <id>snapshots</id>
      <name>libs-snapshot</name>
      <url>http://tls.local:9081/artifactory/libs-snapshot</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>

我们怎样才能实现我们的目标?

首先我们必须将我们的 jfrog 存储库的 maven 快照版本行为配置为唯一并检查句柄版本和处理快照,然后完全删除我们本地存储库的快照