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

BND might get wrong file extension #5286

Closed
laeubi opened this issue Jun 17, 2022 · 1 comment · Fixed by #5309
Closed

BND might get wrong file extension #5286

laeubi opened this issue Jun 17, 2022 · 1 comment · Fixed by #5309
Assignees
Milestone

Comments

@laeubi
Copy link
Contributor

laeubi commented Jun 17, 2022

AbstractBndMavenPlugin makes the (wrong) assumption that the file extension is always the packaging type, while this is true for some (e.g. jar/war) this is not generally true.

private File createArtifactFile() {
return new File(targetDir, project.getBuild()
.getFinalName()
+ getClassifier().map("-"::concat)
.orElse("")
+ "." + project.getPackaging());
}

Instead BND should query the org.apache.maven.artifact.handler.manager.ArtifactHandlerManager e.g.

public String getExtension(String packaging) {
    if (packaging == null) {
        return "jar";
    }
    ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(packaging);
    return handler.getExtension();
}
@bjhargrave bjhargrave self-assigned this Jun 17, 2022
@bjhargrave bjhargrave added this to the 6.4 milestone Jun 17, 2022
bjhargrave added a commit to bjhargrave/bnd that referenced this issue Jul 5, 2022
@laeubi
Copy link
Contributor Author

laeubi commented Jul 5, 2022

Thanks for fixing this 👍

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.

2 participants