Skip to content

Expanding default values #116

@KyRobbins

Description

@KyRobbins

Not sure if I'm doing something obviously wrong, but noticing odd behavior where nested placeholders aren't being properly parsed.

Setting up the simple example:
local.properties

defined.value=myValue
some.value=${defined.value:${user.home}}

pom.xml

<build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>read-properties</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <useDefaultValues>true</useDefaultValues>
                            <files>
                                <file>${project.basedir}/local.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
</build>

${some.value} is resolving as myValue} (Note the unwanted }).

Looking at the logic in https://github.com/mojohaus/properties-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/properties/DefaultValuesAwareExpansionBufferImpl.java#L32-L43 (and related logic in https://github.com/mojohaus/properties-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/properties/ExpansionBuffer.java#L60-L81)

It doesn't seem, offhand, that nested placeholders are being properly accounted for, or am I making a silly mistake?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions