Skip to content

Commit e4f49b6

Browse files
committed
fix root pom sorting
1 parent 958e9e3 commit e4f49b6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

monorepo-migration/update_root_pom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
import re
1617
import sys
1718

1819
def update_root_pom(pom_path, module_name):
@@ -39,7 +40,7 @@ def update_root_pom(pom_path, module_name):
3940
java_lines = lines[start_java:end_java]
4041
if not any(f'<module>{module_name}</module>' in l for l in java_lines):
4142
java_lines.append(new_module)
42-
java_lines.sort()
43+
java_lines.sort(key=lambda l: re.search(r'<module>(.*?)</module>', l).group(1) if '<module>' in l else l)
4344
lines = lines[:start_java] + java_lines + lines[end_java:]
4445
else:
4546
if not any(f'<module>{module_name}</module>' in l for l in lines):

0 commit comments

Comments
 (0)