querydsl / apt-maven-plugin

Maven APT plugin
Apache License 2.0
79 stars 41 forks source link

Support multiple source directories #32

Open anthony-o opened 9 years ago

anthony-o commented 9 years ago

Here is my use case : I'm generating my @Entity files into target/generated-sources/another-plugin with another maven plugin.

I would like com.mysema.maven:apt-maven-plugin to be able to handle multiple sources directories with for example a configuration parameter like <sourceDirectories>.

timowest commented 9 years ago

Are you executing the plugins in the right order? And the apt-maven-plugin doesn't pick up the source folder of your other plugin execution?

timowest commented 9 years ago

@anthony-o Have you been able to resolve the issue?

anthony-o commented 9 years ago

Thanks for your replies @timowest .

Yes, I'm executing the plugins in the right order (the other plugin THEN com.mysema.maven:apt-maven-plugin:1.1.3) and the sources were not taken into account.

As a workaround, for now I'm generating the entities with the other plugin in src/main/other_plugin_generated_src and configured this as a source using:


<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.9.1</version>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>src/main/other_plugin_generated_src</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

And with this, apt-maven-plugin use my generated entities.

timowest commented 9 years ago

How do the sources of the other plugin get compiled, if the folder is not added as a compile source root?

Tcharl commented 8 years ago

Hi,

I've the same issues, my sources that should be processed by apt-maven-plugin are in the src/main/java and the src/main/java-gen package. The plugin is compiled, because of the build-helper-plugin 'add-source' MOJO that add the java-gen folder in the classpath. Unfortunately, apt-maven-plugin only uses the src/main/java folder. It should be nice to either take in account the sources folders added by build-helper (the hard but optimal way), or at least add a mojo parameter 'additionalSourceRoot' parameter. Unfortunately, I don't have the time to contribute for now, I'll do it when I will, but it can be long. Can anyone investigate on it?

Best regards, Charlie

Kiemes commented 4 years ago

Seems the coding is in since 2016 https://github.com/querydsl/apt-maven-plugin/blob/b60bb8eafbda1e011bc9fcaefc0bd2860e6d161e/src/main/java/com/mysema/maven/apt/AbstractProcessorMojo.java#L120 but there is not release cut and hence no new version available on https://mvnrepository.com/artifact/com.mysema.maven/apt-maven-plugin (latest of Nov 2014) Could you please create a new release?