IDEA-116921 Run configuration can't resolve test dependency when "Resolve workspace artifacts" ticked on.

This commit is contained in:
Sergey Evdokimov
2013-11-25 22:00:12 +04:00
parent 12909239c4
commit d06f31a431
4 changed files with 22 additions and 2 deletions
@@ -56,6 +56,10 @@ public class MavenModuleMap {
public boolean resolveToModule(Artifact artifact) {
String extension = artifact.getArtifactHandler().getExtension();
if ("jar".equals(extension) && "test-jar".equals(artifact.getType())) {
extension = "test-jar";
}
File file = findArtifact(artifact.getGroupId(), artifact.getArtifactId(), extension, artifact.getBaseVersion());
if(file == null) {
@@ -52,7 +52,12 @@ public class MyWorkspaceReader implements WorkspaceReader {
}
public File findArtifact(Artifact artifact) {
return MavenModuleMap.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
String type = artifact.getExtension();
if ("jar".equals(type) && "tests".equals(artifact.getClassifier())) {
type = "test-jar";
}
return MavenModuleMap.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(), type,
artifact.getBaseVersion());
}
@@ -52,7 +52,12 @@ public class IntelliJWorkspaceReaderM31 implements WorkspaceReader {
}
public File findArtifact(Artifact artifact) {
return MavenModuleMap.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
String type = artifact.getExtension();
if ("jar".equals(type) && "tests".equals(artifact.getClassifier())) {
type = "test-jar";
}
return MavenModuleMap.getInstance().findArtifact(artifact.getGroupId(), artifact.getArtifactId(), type,
artifact.getBaseVersion());
}
@@ -260,6 +260,12 @@ public class MavenExternalParameters {
+ ':' + mavenProject.getMavenId().getVersion(),
mavenProject.getFile().getPath());
res.setProperty(mavenProject.getMavenId().getGroupId()
+ ':' + mavenProject.getMavenId().getArtifactId()
+ ":test-jar"
+ ':' + mavenProject.getMavenId().getVersion(),
mavenProject.getTestOutputDirectory());
res.setProperty(mavenProject.getMavenId().getGroupId()
+ ':' + mavenProject.getMavenId().getArtifactId()
+ ':' + mavenProject.getPackaging()