Thomas Thrien created MCOMPILER-177:
---------------------------------------

             Summary: Define a flag that is visible to the annotation Processor 
instance to detect a testCompile
                 Key: MCOMPILER-177
                 URL: https://jira.codehaus.org/browse/MCOMPILER-177
             Project: Maven 2.x Compiler Plugin
          Issue Type: New Feature
            Reporter: Thomas Thrien


If you use annotations to generate test code, perhaps for the code you 
previously generated, this should compile to target/test-classes rather than 
classes. And the production code should not be found in test-classes, too.

Therefore a flag would be nice that the Processor could know in which compile 
it is invoked (compile or testCompile).

You can achieve that by setting compiler arguments, but this would be valid 
only for your project; if someone comes with a processor interpreting a 
different flag, your POM will end up with dozens of compiler arguments, all 
doing the same.

So modifying getCompilerArguments() in CompileMojo.java and 
TestCompileMojo.java that they will add the flag 
"-Amaven.test.build={false|true}" to the returned map would do the job - with 
the consequence that the method will never return null. 

Maybe it would be an alternative to provide the goal as an argument 
("-Amaven.goal=<goal>"). In this case only AbstractCompilerMojo.execute() needs 
to be modified.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to