Skip to content

Conversation

@alexgracianoarj
Copy link

@alexgracianoarj alexgracianoarj commented Jun 3, 2021

search_regex =

default: none

Regex to search for the string to be replaced in the file.
Support {current_version} template string (e.g. (?<=version='){current_version}(?=')).
If search_regex is defined, the search template string will be ignored in the section.

[bumpversion]
current_version = 2.4.5

[bumpversion:file:pom.xml]
search_regex = (?<=test-app-java</artifactId>\n\s{4}<version>){current_version}(?=</version>)
search = <version>{current_version}</version> ; will be ignored
replace = {new_version}

Example of use, when the application version is the same as some dependencies (java application, pom.xml):

    ...
    <artifactId>test-app-java</artifactId>
    <version>2.4.5</version>
    <packaging>jar</packaging>
    ...
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.4.5</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    ...
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.4.5</version>
                </plugin>
            </plugins>
        </pluginManagement>
    ...

Also available as --search-regex

@eduzen
Copy link

eduzen commented Jul 8, 2021

Hi @alexgracianoarj, could I help you in somehow with this? maybe we can add some description to make it more clear?

@florisla
Copy link
Collaborator

Hi,

The example in the README (MyProject==) does not make clear why you would use this instead of regular search.

Could you elaborate a bit (in this issue) what you are using this for?

@alexgracianoarj
Copy link
Author

Hi @eduzen and @florisla, i have update the README file and description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants