Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Tanasenko2015-05-25 08:24:42 -0400
committerAnton Tanasenko2015-05-25 08:24:42 -0400
commitd9a3f3c9d6954372ba5b7899cfcdee45fa0b43da (patch)
tree55beba08587c78a8f66d496888a15afbfb6ddb5a
parent1ed27012d55268d24237f9862a353c8ac02437cd (diff)
downloadm2e-core-d9a3f3c9d6954372ba5b7899cfcdee45fa0b43da.tar.gz
m2e-core-d9a3f3c9d6954372ba5b7899cfcdee45fa0b43da.tar.xz
m2e-core-d9a3f3c9d6954372ba5b7899cfcdee45fa0b43da.zip
468164 Missing managed transitive dependency marker is shown at a weird
location Change-Id: Id92ee33574959ad07f97a95955f6a623ed9171b1 Signed-off-by: Anton Tanasenko <atg.sleepless@gmail.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java
index 0b7962a5..24dec05e 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/markers/SourceLocationHelper.java
@@ -12,10 +12,12 @@
package org.eclipse.m2e.core.internal.markers;
import java.io.File;
+import java.util.List;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.core.resources.IResource;
+import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.InputLocation;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
@@ -143,7 +145,19 @@ public class SourceLocationHelper {
}
private static org.apache.maven.model.Dependency getMavenDependency(MavenProject mavenProject, Dependency dependency) {
- for(org.apache.maven.model.Dependency mavenDependency : mavenProject.getDependencies()) {
+ org.apache.maven.model.Dependency found = findDependency(mavenProject.getDependencies(), dependency);
+ if(found == null) {
+ DependencyManagement depMgmt = mavenProject.getModel().getDependencyManagement();
+ if(depMgmt != null) {
+ found = findDependency(depMgmt.getDependencies(), dependency);
+ }
+ }
+ return found;
+ }
+
+ private static org.apache.maven.model.Dependency findDependency(List<org.apache.maven.model.Dependency> dependencies,
+ Dependency dependency) {
+ for(org.apache.maven.model.Dependency mavenDependency : dependencies) {
if(mavenDependency.getArtifactId().equals(dependency.getArtifact().getArtifactId())
&& mavenDependency.getGroupId().equals(dependency.getArtifact().getGroupId())
&& mavenDependency.getVersion().equals(dependency.getArtifact().getVersion())
@@ -177,8 +191,7 @@ public class SourceLocationHelper {
if(inputLocation == null) {
// Should never happen
inputLocation = mavenProject.getModel().getLocation(SELF);
- return new SourceLocation(inputLocation.getLineNumber(), inputLocation.getColumnNumber() - PROJECT.length()
- - COLUMN_START_OFFSET, inputLocation.getColumnNumber() - COLUMN_END_OFFSET);
+ return new SourceLocation(inputLocation.getLineNumber(), 1, inputLocation.getColumnNumber() - COLUMN_END_OFFSET);
}
File pomFile = mavenProject.getFile();

Back to the top