IntelliJ like 'Extract Property' to extract maven artifact versions to properties in eclipse
Asked Answered
C

1

7

IntelliJ provides Extract Property refactoring which can be used to extract maven artifact versions to properties in pom.xml.

Extract Property refactoring creates a new property definition in the specified pom.xml file, finds all the occurrences of the selected string in the hierarchy of pom.xml files, and replaces them with the above property in the format: ${}

https://www.jetbrains.com/help/idea/2016.2/extract-property.html

Does eclipse have something similar?

Collectivity answered 23/9, 2016 at 7:54 Comment(0)
C
1

It seems that Eclipse didn't have such feature.
So I extracted the version by myself with a Java Helper class:
https://github.com/brabenetz/secured-properties/blob/master/src/test/java/net/brabenetz/lib/securedproperties/tools/ExtractPomVersions.java

Feel free to copy, past and modify the code.

Background: I personally do not like the versions as property, because for defining the right versions there are dependency-management and plugin-management sections in Maven.
But it seems that the version-maven-plugin only works at best if it can update versions in properties:
http://www.mojohaus.org/versions-maven-plugin/update-properties-mojo.html

Clownery answered 1/1, 2018 at 16:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.