If you have written the plugin by yourself you can programatically add the path with the generated sources to the maven source paths.
@Mojo(name = "generate")
public class MyCodegenMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}")
private MavenProject project;
@Override
public void execute() throws MojoExecutionException, MojoFailureException{
// your generator code
project.addCompileSourceRoot("path/to/your/generated/sources");
}
}
For example the raml-jaxrs-codegen plugin uses this technique. See RamlJaxrsCodegenMojo.java for more details.