You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Martin Franklin (JIRA)" <ji...@codehaus.org> on 2012/09/12 22:05:21 UTC

[jira] (MCOMPILER-157) Maven Compiler Plugin should add to compileSourceRoots for next plugins to consider as source directory for generated files

    [ https://jira.codehaus.org/browse/MCOMPILER-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=308374#comment-308374 ] 

Martin Franklin commented on MCOMPILER-157:
-------------------------------------------

I managed to get this working using the helper plugin in combination with a second invocation of the compiler.

Let compiler run normally and generate the annotation processor output.

Then invoke the help plugin at the process-classes lifecycle stage, followed by the compiler again.

Note that the order is important, so that the build-helper gets invoked before the compiler.


<plugins>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>1.7</version>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>process-classes</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>target/generated-sources/annotations</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>process-classes</phase>
						<goals>
							<goal>compile</goal>
						</goals>

					</execution>
				</executions>
			</plugin>
		</plugins>
                
> Maven Compiler Plugin should add to compileSourceRoots for next plugins to consider as source directory for generated files 
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MCOMPILER-157
>                 URL: https://jira.codehaus.org/browse/MCOMPILER-157
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3.2
>         Environment: Java 6
>            Reporter: Zoran Regvart
>             Fix For: 2.6
>
>         Attachments: maven-compiler-plugin-add-compileSourceRoots.patch, maven-compiler-plugin-addToSourcePathAsWell.patch, TestCase2.zip, test-case.zip
>
>
> Maven Compiler Plugin by relying on javac by default, on Java 6 platform includes annotation processors in it's processing, these in end could generate sources that are placed by default in target/generated-sources/annotations. The later should be added to compileSourceRoots so that next plugin in execution would consider those sources.
> Please, see the attached test case and consider the attached patch in the next release of maven-compiler-plugin.
> thanks,
> Zoran

--
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