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

org.sonatype.maven.polyglot.TeslaModelProcessor.locatePom(File) ignores files ending in.xml #192

Closed
laeubi opened this issue Aug 20, 2019 · 6 comments · Fixed by #196
Closed

Comments

@laeubi
Copy link
Contributor

laeubi commented Aug 20, 2019

redirected here from https://issues.apache.org/jira/browse/MNG-6742
in org.sonatype.maven.polyglot.TeslaModelProcessor.locatePom(File) there is the following code:

File pomFile = manager.locatePom(dir);
   if (pomFile != null && !pomFile.getName().endsWith(".pom") && !pomFile.getName().endsWith(".xml")) {
...
}

This makes it impossible to return any file with xml ending as alternative to pom.xml, in my case data is stored in a file named category.xml and i can't use it because then my Mapping is never called.

@mickaelistria
Copy link

I imagine this is some old stuff from unsupported Maven version that has been staying there for long without annoying anyone so far.
In the Maven code base, the only reference to .pom extension is in ProjectArtifactMetadata.getFileName() (which seems unrelated in the lifecycle of polyglot-maven, and I don't see reference to other specific .xml file in the project other than pom.xml.

I think this whole condition could be replaced with pomFile != null && "pom.xml".equals(pomFile.getName()).
@laeubi are you going to send a PR for a similar change?

@laeubi
Copy link
Contributor Author

laeubi commented Aug 20, 2019

@mickaelistria not yet, but I think it would be better that a maintainer takes a look at it, becuase there is also another issue: javadoc states "The path to the (possibly non-existent) POM file, never null." for the called manager, but code still checks for null (what can hide malformed Managers, better would to throw an exception then).

@mickaelistria
Copy link

Ok, let's wait for feedback. But if you don't receive any in a good time, just send a PR. Maintainers often looks at PR with more interest than they look at issues; once "hooked" on the PR, some maintainers who were silent on issues give interesting feedback ;)

@mosabua
Copy link
Member

mosabua commented Aug 20, 2019

I would have to look into this in more detail but probably wont have time soon. Can you see what happens if you change.... it might have weird side effects since we generate the pom.xml file . Not sure how good test coverage around that is either. Definitely worth checking out though so I encourage you to look into it so we can fix it ..

@akurtakov
Copy link

@laeubi do you mind creating PR for your commit so we can see polyglot-maven devs review on it?

@laeubi
Copy link
Contributor Author

laeubi commented Oct 23, 2019

Already there: #196

mosabua added a commit that referenced this issue Nov 25, 2019
Fix #192 TeslaModelProcessor.locatePom(File) ignores files ending in.xml
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.

4 participants