Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kwin opened this issue Apr 4, 2024 · 0 comments · May be fixed by #1731
Open

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

kwin opened this issue Apr 4, 2024 · 0 comments · May be fixed by #1731

Comments

@kwin
Copy link
Member

kwin commented Apr 4, 2024

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.

kwin added a commit that referenced this issue Apr 4, 2024
@kwin kwin linked a pull request Apr 4, 2024 that will close this issue
kwin added a commit that referenced this issue Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant