Skip to content

Never return path to pom.xml for artifact files except for type = "pom" #1730

@kwin

Description

@kwin

Currently the logic in

if(!POM_EXTENSION.equals(extension)) {
MavenProjectFacade facade = context.state.getProjectFacade(pom);
IWorkspaceClassifierResolver resolver = MavenPlugin.getWorkspaceClassifierResolverManager().getResolver();
IPath location = resolver.resolveClassifier(facade, classifier);
if(location == null) {
location = facade.getOutputLocation();
}
if(location != null) {
IResource res = root.findMember(location);
if(res != null) {
file = res.getLocation();
}
}
}
return file.toFile();
may return the pom.xml path. This is used in
public org.apache.maven.artifact.Artifact find(org.apache.maven.artifact.Artifact artifact) {
(an implementation of the Maven SPI org.apache.maven.artifact.repository.ArtifactRepository) to set the artifact's file.

Although returning the path to the pom.xml makes sense for type being pom it doesn't for any other type. In that case one should rather fall back to null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions