1414import org .artifactory .fs .ItemInfo ;
1515import org .artifactory .repo .RepoPath ;
1616import org .artifactory .repo .Repositories ;
17+ import org .artifactory .repo .RepositoryConfiguration ;
1718import org .jetbrains .annotations .NotNull ;
1819import org .slf4j .Logger ;
1920import org .slf4j .LoggerFactory ;
@@ -97,6 +98,11 @@ private void filter(MonitoredArtifact artifact) {
9798 private @ NotNull MonitoredArtifact toMonitoredArtifact (TestResult testResult , @ NotNull RepoPath repoPath ) {
9899 Ignores ignores = Ignores .read (new RepositoryArtifactProperties (repoPath , repositories ));
99100 Instant lastModifiedDate = getLastModifiedDate (repoPath );
101+
102+ // Only apply lastModifiedDate to packages from remote repositories.
103+ if (!isRemoteRepository (repoPath )) {
104+ lastModifiedDate = null ;
105+ }
100106 return new MonitoredArtifact (repoPath .toString (), testResult , ignores , lastModifiedDate );
101107 }
102108
@@ -108,11 +114,21 @@ private Instant getLastModifiedDate(RepoPath repoPath) {
108114 return lastModified ;
109115 }
110116 } catch (Exception e ) {
111- LOG .debug ("Could not retrieve created date for {}: {}" , repoPath , e );
117+ LOG .debug ("Could not retrieve last modified date for {}: {}" , repoPath , e );
112118 }
113119 return null ;
114120 }
115121
122+ private boolean isRemoteRepository (RepoPath repoPath ) {
123+ String repoKey = repoPath .getRepoKey ();
124+ RepositoryConfiguration repoConfig = repositories .getRepositoryConfiguration (repoKey );
125+ repoType = repoConfig .getType ();
126+
127+ LOG .debug ("Found repository type: {}" , repoType );
128+
129+ return repoType == "remote" ;
130+ }
131+
116132 private boolean shouldTestContinuously () {
117133 return configurationModule .getPropertyOrDefault (PluginConfiguration .TEST_CONTINUOUSLY ).equals ("true" );
118134 }
0 commit comments