Value from Maven profile properties is not getting used in .properties file
Asked Answered
M

1

1

I've below pom.xml file

<resources>
            <resource>
                <directory>${basedir}</directory>
                <includes>
                    <include>*.properties</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>

<profiles>
        <profile>
            <id>android</id>
            <properties>
                <automationName>uiautomator2</automationName>
                <platformName>Android</platformName>
                <platformVersion>6.0</platformVersion>
                <deviceName>Android Emulator</deviceName>
                <app>/Users/name/Documents/serenity-core/serenity-appium/src/test/java/integration/resources/WordPress-debug.apk</app>
                <appPackage>org.wordpress.android</appPackage>
                <appActivity>org.wordpress.android.ui.accounts.LoginActivity</appActivity>
            </properties>
        </profile>

        <profile>
            <id>ios</id>
            <properties>
                <automationName>XCUITest</automationName>
                <platformName>IOS</platformName>
                <platformVersion>11.4</platformVersion>
                <deviceName>iPhone SE</deviceName>
                <app>/Users/name/Documents/serenity-core/serenity-appium/src/test/java/integration/resources/WordPress.app</app>
            </properties>
        </profile>
    </profiles>

I've got serenity.properties file as below

appium.automationName = ${automationName}
appium.platformName = ${platformName}
appium.platformVersion = ${platformVersion}
appium.deviceName  = ${deviceName}
appium.app = ${app}

When I am trying to use values from pom.xml as below it doesn't work as expected. Serenity.properties file doesn't the get values mentioned under particular profile name.

mvn install -Pandroid
Mutism answered 5/7, 2018 at 8:45 Comment(4)
If I were you I would rush to remove a few details from the POM you published: your username and OS type is clearly visible and you are so exposing yourself to hackingRecognition
@RobertoLoGiacco Thanks, I've edited the question, can you please let me know what am I doing wrong with above setup ?Mutism
@Mutism Did you get an answer to this? I have the same issueBraden
@Braden no didn't find any solution yetMutism
A
2

Your directory specification is wrong. Do not use ${basedir} but ${project.basedir}, then it works as expected:

<directory>${project.basedir}</directory>

Even better would be to stick with the standard Maven directory layout and put your resources here:

<directory>src/main/resources</directory>
Aesthetically answered 28/10, 2020 at 6:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.