Specifying a default argument in pom.xml and overriding it in the command line

The only function of my main class is to read from an xml config file, which I’m currently specifying in the command line. Is it possible to make it so a default config file is specified in pom.xml, so if the program is run from the command line without passing in an argument, that config file is read, but if an argument is passed in with -Dexec.args the default is overridden?

at first look at exec plugin documentation here

in your maven in properties specify your default property which you want look at my.custom.property

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test.test</groupId>
    <artifactId>test</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.debug>true</maven.compiler.debug>
        <!-- frameworks -->

        <!-- properties -->
        <my.custom.property>MAVEN</my.custom.property>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>test.Test</mainClass>
                    <arguments>
                        <argument>${my.custom.property}</argument>
                    </arguments>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

here is java class

package test;

import java.util.stream.Stream;


public class Test {

    public static void main(String[] args) {
        Stream.of(args)
                .forEach(arg -> System.out.println("ARGUMENT " + arg));
    }
}

and if you execute mvn compile exec:java you should see somewhere outpu ARGUMENT MAVEN. If you provide your own argument eg. mvn compile exec:java -Dmy.custom.property=TEST you should see ARGUMENT TEST somewhere in console.