IDEA-81486 (IDEA complains about "stable" snapshot dependencies)

Don't highlight stable snapshot dependencies red.
This commit is contained in:
Sergey Evdokimov
2012-02-26 16:33:35 +04:00
parent 2389a06877
commit 814efeeee9
@@ -22,8 +22,12 @@ import org.jetbrains.idea.maven.model.MavenId;
import java.util.Collections;
import java.util.Set;
import java.util.regex.Pattern;
public class MavenArtifactCoordinatesVersionConverter extends MavenArtifactCoordinatesConverter {
private static final Pattern MAGIC_VERSION_PATTERN = Pattern.compile("\\s*(?:LATEST|RELEASE|[(\\[].*|.*-20\\d{6}\\.[0-2]\\d{5}-\\d+)\\s*");
@Override
protected boolean doIsValid(MavenId id, MavenProjectIndicesManager manager, ConvertContext context) {
if (StringUtil.isEmpty(id.getGroupId())
@@ -31,15 +35,10 @@ public class MavenArtifactCoordinatesVersionConverter extends MavenArtifactCoord
|| StringUtil.isEmpty(id.getVersion())) {
return false;
}
if (isMagicVersion(id)) return true; // todo handle ranges more sensibly
if (MAGIC_VERSION_PATTERN.matcher(id.getVersion()).matches()) return true; // todo handle ranges more sensibly
return manager.hasVersion(id.getGroupId(), id.getArtifactId(), id.getVersion());
}
private boolean isMagicVersion(MavenId id) {
String version = id.getVersion().trim();
return version.equals("LATEST") || version.equals("RELEASE") || version.startsWith("(") || version.startsWith("[");
}
@Override
protected Set<String> doGetVariants(MavenId id, MavenProjectIndicesManager manager) {
if (StringUtil.isEmpty(id.getGroupId()) || StringUtil.isEmpty(id.getArtifactId())) return Collections.emptySet();