From ef69feb93d5e6af84fff2792cf7b5436ed70cf6b Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Tue, 26 Feb 2013 16:38:43 +0400 Subject: [PATCH] IDEA-101631 Updating Maven snapshots with sources does not synchronize sources to latest when navigating to class Fix tests. --- .../maven/importing/MavenRootModelAdapter.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java index 6aaf850d5d28..614dbce63f96 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java @@ -327,24 +327,15 @@ public class MavenRootModelAdapter { String newUrl = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, newPath) + JarFileSystem.JAR_SEPARATOR; for (String url : library.getUrls(type)) { if (newUrl.equals(url)) return; - if (clearAll || isRepositoryUrl(artifact, url, classifier, extension)) { + if (clearAll || isRepositoryUrl(artifact, url)) { library.removeRoot(url, type); } } library.addRoot(newUrl, type); } - private static boolean isRepositoryUrl(MavenArtifact artifact, String url, @Nullable String classifier, @Nullable String extension) { - if (!url.contains(artifact.getGroupId() + '/' + artifact.getArtifactId() + '/' + artifact.getBaseVersion() + '/' + artifact.getArtifactId() + '-')) { - return false; - } - - String fileName = artifact.getFileNameWithBaseVersion(classifier, extension); - assert StringUtil.startsWithConcatenationOf(fileName, artifact.getArtifactId(), "-", artifact.getVersion()); - - String suffix = fileName.substring(artifact.getArtifactId().length() + 1 + artifact.getVersion().length()); - - return StringUtil.trimEnd(url, "!/").endsWith(suffix); + private static boolean isRepositoryUrl(MavenArtifact artifact, String url) { + return url.contains(artifact.getGroupId().replace('.', '/') + '/' + artifact.getArtifactId() + '/' + artifact.getBaseVersion() + '/' + artifact.getArtifactId() + '-'); } public static boolean isChangedByUser(Library library) {