@@ -356,7 +356,6 @@ void useHttpWhenHttpsFails() throws Exception {
356356 }
357357 }
358358
359- @ Disabled
360359 @ Test
361360 void dontFetchSnapshotsFromReleaseRepos () throws Exception {
362361 try (MockWebServer snapshotRepo = new MockWebServer ();
@@ -464,6 +463,50 @@ public MockResponse dispatch(RecordedRequest request) {
464463 }
465464 }
466465
466+ @ Test
467+ void datedSnapshotVersionIncludesSnapshotRepositories () throws Exception {
468+ try (MockWebServer snapshotRepo = new MockWebServer ()) {
469+ snapshotRepo .setDispatcher (new Dispatcher () {
470+ @ Override
471+ public MockResponse dispatch (RecordedRequest request ) {
472+ MockResponse response = new MockResponse ().setResponseCode (200 );
473+ if (request .getPath () != null && request .getPath ().endsWith (".pom" )) {
474+ //language=xml
475+ response .setBody (
476+ """
477+ <project>
478+ <groupId>com.example</groupId>
479+ <artifactId>my-lib</artifactId>
480+ <version>3.28.0-SNAPSHOT</version>
481+ </project>
482+ """
483+ );
484+ }
485+ return response ;
486+ }
487+ });
488+
489+ snapshotRepo .start ();
490+
491+ var downloader = new MavenPomDownloader (emptyMap (), ctx );
492+ var snapshotRepoModel = MavenRepository .builder ()
493+ .id ("snapshots" )
494+ .uri ("http://%s:%d" .formatted (snapshotRepo .getHostName (), snapshotRepo .getPort ()))
495+ .releases ("false" )
496+ .snapshots (true )
497+ .build ();
498+
499+ // A dated snapshot version should be recognized as a snapshot so that
500+ // snapshot-only repositories are not excluded.
501+ Pom pom = downloader .download (
502+ new GroupArtifactVersion ("com.example" , "my-lib" , "3.28.0-20260220.175218-20" ),
503+ null , null , List .of (snapshotRepoModel ));
504+
505+ assertThat (pom ).isNotNull ();
506+ assertThat (snapshotRepo .getRequestCount ()).isGreaterThan (0 );
507+ }
508+ }
509+
467510 @ Issue ("https://github.com/openrewrite/rewrite-maven-plugin/issues/862" )
468511 @ Test
469512 void fetchSnapshotWithCorrectClassifier () throws Exception {
0 commit comments