Reputation: 23
I'm writing a small project to learn about Maven and Spring Framework. To run my project I run following command:
clean install exec:java -e -DinputFolder=src/main/resources/testCases
Is there a way to make inputFolder parameter mandatory when running this?
Thanks.
Upvotes: 2
Views: 212
Reputation: 23248
The Maven Enforcer Plugin can be used to require properties to be configured for your build. The requireProperty rule will do the job.
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>inputFolder</property>
<message>inputFolder property must be set</message>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>
Upvotes: 3