tycho
tycho copied to clipboard
tycho-versions-plugin:2.4.0:update-pom fails for poms that are not named 'pom.xml
If the goal update-pom of the plugin tycho-versions-plugin is executed on a pom that is not named pom.xml, the execution fails
Console snippet:
$ mvn -f products/com.bar.foo.ide.pom.xml org.eclipse.tycho:tycho-versions-plugin:2.4.0:update-pom
...
[INFO] --- tycho-versions-plugin:2.4.0:update-pom (default-cli) @ com.bar.foo.ide.dependency ---
[WARNING] No pom file found at C:\repos\foo\maven\build\products
[INFO] Not a maven project C:\repos\foo\maven\build\products
...
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-versions-plugin:2.4.0:update-pom (default-cli) on project com.bar.foo.ide.dependency: Execution default-cli of goal org.eclipse.tycho:tycho-versions-plugin:2.4.0:update-pom failed: no pom avaiable for C:\repos\foo\maven\build\products -> [Help 1]
Could you provide a PR to fix the issue or an integration-test to demonstrate the issue?
I've created an PR with integration tests (#1346) I was not able to fix the issue since I'm not familiar with maven plugins, but the issue seems to be the code in ProjectMetadataReader#addBasedir()
for (ModelProcessor modelProcessor : modelprocessors) {
File locatePom = modelProcessor.locatePom(basedir);
if (basedir.exists()) {
pomFile = locatePom;
break;
}
}
"modelProcessor" is a "DefaultModelLocator" which will always return "pom.xml" as a file. This can not be correct since the name of a pom can be any valid file name.
Also the line if (basedir.exists()) seems to be wrong. base.exists() can only be true at that point since it was checked earlier in the method. This should probably be changed to if (locatePom.exists())
"modelProcessor" is a "DefaultModelLocator" which will always return "pom.xml" as a file. This can not be correct since the name of a pom can be any valid file name.
Actually that is how maven works, can you give an example of "the name of a pom can be any valid file name" if not given explicitly on the commandline with --file ? Do you mean e.g. in parent references?
Also the line
if (basedir.exists())seems to be wrong.base.exists()can only be true at that point since it was checked earlier in the method. This should probably be changed toif (locatePom.exists())
Seems reasonable, can you do that in your PR.
I was not able to fix the issue since I'm not familiar with maven plugins
Don't hesitate to ask here and as you do not need to create one from scratch just try it out :+1:
Regarding
Actually that is how maven works, can you give an example of "the name of a pom can be any valid file name" if not given explicitly on the commandline with --file ? Do you mean e.g. in parent references?
What i mean is that the file name of a pom can be any valid filename when specified on the command line with --file, which is the case here. the following command line will always fail
mvn -f "Anything else then pom.xml" org.eclipse.tycho:tycho-versions-plugin:update-pom
Seems reasonable, can you do that in your PR.
Ok, i'll do it later
Alright, then your next step could be to read the passed file from the Maven Session and the fetch the MavenExcution request that has a "getPom" and then hopefully there you find "Anything else then pom.xml" that could additionally be considered :-)