MavenProject depProject = myMavenTree.findProject(artifact.getMavenId());
- if (depProject != null && !myMavenTree.isIgnored(depProject)) {
+ if (depProject != null) {
if (depProject == myMavenProject) continue;
- boolean isTestJar = MavenConstants.TYPE_TEST_JAR.equals(dependencyType) || "tests".equals(artifact.getClassifier());
- myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), scope, isTestJar);
- Element buildHelperCfg = depProject.getPluginGoalConfiguration("org.codehaus.mojo", "build-helper-maven-plugin", "attach-artifact");
- if (buildHelperCfg != null) {
- addAttachArtifactDependency(buildHelperCfg, scope, depProject, artifact);
- }
-
- if (artifact.getClassifier() != null
- && !isTestJar
- && !"system".equals(artifact.getScope())
- && !"false".equals(System.getProperty("idea.maven.classifier.dep"))) {
- MavenArtifact a = new MavenArtifact(
+ if (myMavenTree.isIgnored(depProject)) {
+ MavenArtifact projectsArtifactInRepository = new MavenArtifact(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion(),
false, false
);
- myRootModelAdapter.addLibraryDependency(a, scope, myModifiableModelsProvider, myMavenProject);
+ myRootModelAdapter.addLibraryDependency(projectsArtifactInRepository, scope, myModifiableModelsProvider, myMavenProject);
+ }
+ else {
+ boolean isTestJar = MavenConstants.TYPE_TEST_JAR.equals(dependencyType) || "tests".equals(artifact.getClassifier());
+ myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), scope, isTestJar);
+
+ Element buildHelperCfg = depProject.getPluginGoalConfiguration("org.codehaus.mojo", "build-helper-maven-plugin", "attach-artifact");
+ if (buildHelperCfg != null) {
+ addAttachArtifactDependency(buildHelperCfg, scope, depProject, artifact);
+ }
+
+ if (artifact.getClassifier() != null
+ && !isTestJar
+ && !"system".equals(artifact.getScope())
+ && !"false".equals(System.getProperty("idea.maven.classifier.dep"))) {
+ MavenArtifact a = new MavenArtifact(
+ artifact.getGroupId(),
+ artifact.getArtifactId(),
+ artifact.getVersion(),
+ artifact.getBaseVersion(),
+ dependencyType,
+ artifact.getClassifier(),
+ artifact.getScope(),
+ artifact.isOptional(),
+ artifact.getExtension(),
+ null,
+ myMavenProject.getLocalRepository(),
+ false, false
+ );
+
+ myRootModelAdapter.addLibraryDependency(a, scope, myModifiableModelsProvider, myMavenProject);
+ }
}
}
else if ("system".equals(artifact.getScope())) {
import gnu.trove.THashSet;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.maven.indices.MavenIndicesManager;
import org.jetbrains.idea.maven.project.*;
import org.jetbrains.idea.maven.utils.MavenProgressIndicator;
assertEquals(new HashSet<T>(expected), new HashSet<T>(actual));
}
protected static void assertUnorderedPathsAreEqual(Collection<String> actual, Collection<String> expected) {
- assertEquals(new THashSet<String>(expected, FileUtil.PATH_HASHING_STRATEGY), new THashSet<String>(actual, FileUtil.PATH_HASHING_STRATEGY));
+ assertEquals(new SetWithToString<String>(new THashSet<String>(expected, FileUtil.PATH_HASHING_STRATEGY)),
+ new SetWithToString<String>(new THashSet<String>(actual, FileUtil.PATH_HASHING_STRATEGY)));
}
protected static <T> void assertUnorderedElementsAreEqual(T[] actual, T... expected) {
private static String getTestMavenHome() {
return System.getProperty("idea.maven.test.home");
}
+
+ private static class SetWithToString<T> extends AbstractSet<T> {
+
+ private final Set<T> myDelegate;
+
+ public SetWithToString(@NotNull Set<T> delegate) {
+ myDelegate = delegate;
+ }
+
+ @Override
+ public int size() {
+ return myDelegate.size();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return myDelegate.contains(o);
+ }
+
+ @NotNull
+ @Override
+ public Iterator<T> iterator() {
+ return myDelegate.iterator();
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return myDelegate.containsAll(c);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return myDelegate.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ return myDelegate.hashCode();
+ }
+ }
+
}