mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-73118 SNAPSHOT dependencies not handled as per Maven 3.0
This commit is contained in:
+33
-19
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.idea.maven.model;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -23,7 +24,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class MavenArtifact implements Serializable {
|
||||
|
||||
@@ -177,25 +177,39 @@ public class MavenArtifact implements Serializable {
|
||||
public String getPathForExtraArtifact(@Nullable String extraArtifactClassifier, @Nullable String customExtension) {
|
||||
String path = getPath();
|
||||
|
||||
if (!StringUtil.isEmptyOrSpaces(extraArtifactClassifier)) {
|
||||
int repoEnd = path.lastIndexOf(getRelativePath());
|
||||
|
||||
if (repoEnd == -1) {
|
||||
// unknown path format: try to add a classified at the end of the filename
|
||||
int dotPos = path.lastIndexOf(".");
|
||||
if (dotPos != -1) {// sometimes path doesn't contain '.'; but i can't find any reason why.
|
||||
String withoutExtension = path.substring(0, dotPos);
|
||||
path = MessageFormat.format("{0}-{1}.{2}",
|
||||
withoutExtension,
|
||||
extraArtifactClassifier,
|
||||
customExtension == null ? myExtension : customExtension);
|
||||
}
|
||||
}
|
||||
else {
|
||||
String repoPath = path.substring(0, repoEnd);
|
||||
path = repoPath + getRelativePathForExtraArtifact(extraArtifactClassifier, customExtension);
|
||||
}
|
||||
if (extraArtifactClassifier == null && customExtension == null && Comparing.equal(myVersion, myBaseVersion)) {
|
||||
return path;
|
||||
}
|
||||
|
||||
int slashPos = path.lastIndexOf('/');
|
||||
if (slashPos != -1) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
res.append(path, 0, slashPos + 1);
|
||||
res.append(myArtifactId);
|
||||
res.append('-');
|
||||
res.append(myVersion);
|
||||
|
||||
String fullClassifier = getFullClassifier(extraArtifactClassifier);
|
||||
if (fullClassifier != null) {
|
||||
res.append('-').append(fullClassifier);
|
||||
}
|
||||
|
||||
res.append('.');
|
||||
res.append(customExtension == null ? myExtension : customExtension);
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
// unknown path format: try to add a classified at the end of the filename
|
||||
int dotPos = path.lastIndexOf('.');
|
||||
if (dotPos != -1) {// sometimes path doesn't contain '.'; but i can't find any reason why.
|
||||
StringBuilder res = new StringBuilder();
|
||||
res.append(path, 0, dotPos);
|
||||
res.append('-');
|
||||
res.append(extraArtifactClassifier);
|
||||
res.append(customExtension == null ? myExtension : customExtension);
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user