Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Resolved
-
3.0.1
-
None
-
None
Description
I have two requirements for consideration:
- Scripts should be able to easily get the resolution status.
- Scripts should be able to easily get the resolved expression value.
When evaluating an expression, the output does not have a good marker to help scripts identity the resolution. Current plugin behavior prints the value (practically buried among Maven's logging) or "null object or invalid expression" message.
The -o option could be used, of course, but file creation is more overhead than necessary. But what is good about the -o option is that it prints a clear marker:
> mvn help:evaluate -Dexpression=settings.localRepository -Doutput=out.txt [INFO] Scanning for projects... . . . [INFO] Result of evaluation written to: c:\proj\out.txt
Can you consider something similar for the console?
Example possible solutions:
> mvn help:evaluate -Dexpression=settings.localRepository [INFO] Scanning for projects... . . . [INFO] Result of evaluation: /home/joeuser/.m2/repository
And again:
> mvn help:evaluate -Dexpression=zzz [INFO] Scanning for projects... . . . [INFO] Result of evaluation: null
PS: If you think current behavior should be preserved, a new plugin option can be introduced. However, as shown by this link, I think people have a difficult time clobbering together an answer to parse reliably. There are other examples on that site if you're interested. So I don't think any effort should be taken with introducing a new option. Just my 2 cents. Since the fragility already exists, just provide an "official" solution to remediate it.
Thank you.