raydac / java-comment-preprocessor

preprocessor for computer languages with C-like comment format (C/C++/Java/Go)
Apache License 2.0
172 stars 27 forks source link

add function to check existence of variable and check its value if exists #10

Closed raydac closed 8 years ago

raydac commented 8 years ago

I am using your preprocessor as a maven plugin. I have this code: xxxx and it does not print when I have not defined the flag, and does when I do. So I know the plug-in preprocessing is taking place. But when I tried enabling the print statements via mvn compile command: /opt/apache-maven-3.2.3/bin/mvn clean install -DskipTests=true -DPRINT_WAYNE_FLAG=true It did not work. Do you know what syntax I should use in the mvn command line to send a flag through mvn to affect the value of preprocessor flags in java code?

raydac commented 8 years ago

since 6.1.1 such case can be processed with

//#if is("PRINT_WAYNE_FLAG",true)
    System.out.println("Exists and TRUE");
//#else
    System.out.println("Does not exist or not TRUE");
//#endif