I have this simple profile which check if file exsist . but the problem is , how to print error massge to the user when it failes to find the file :
<profiles>
<profile>
<id>my-json-test</id>
<activation>
<file>
<exists>/foo/test.json</exists>
</file>
</activation>
<build>
.....
Say the file /foo/test.json dosn't exixst .. how this activation can print error ? as now it do not print any thing just fail the build task .
It looks like you are using profiles for the wrong reason. As I read it you want to enforce that this file exists. As with anything you want to enforce, the maven-enforcer-plugin is your friend. In this case try https://maven.apache.org/enforcer/enforcer-rules/requireFilesExist.html