From 5032dfbe3a04b8be572e752a4a7fc142e000828e Mon Sep 17 00:00:00 2001 From: mapan Date: Wed, 24 Jul 2024 23:08:02 +0800 Subject: [PATCH] remove pom properties revision property --- src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java b/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java index 20342048..58df7ec2 100644 --- a/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java +++ b/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java @@ -610,6 +610,13 @@ protected Model createFlattenedPom(File pomFile) throws MojoExecutionException, } } + // remove pom.xml properties revision property + String oldVersion = originalPom.getVersion(); + if (oldVersion != null && !oldVersion.isEmpty() && oldVersion.startsWith("${") && oldVersion.endsWith("}")) { + getLog().info("find version " + oldVersion + " remove to properties"); + flattenedPom.getProperties().remove(oldVersion.substring(2, oldVersion.length() - 1)); + } + return flattenedPom; } @@ -922,9 +929,9 @@ protected Model createEffectivePom( } } }; - buildingResult = modelBuilderThreadSafetyWorkaround.build( buildingRequest, customInjector, new DefaultProfileSelector()); + } catch (ModelBuildingException e) { throw new MojoExecutionException(e.getMessage(), e); }