Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven plugin does not support generating test sources #44

Closed
derkork opened this issue Oct 6, 2022 · 0 comments
Closed

Maven plugin does not support generating test sources #44

derkork opened this issue Oct 6, 2022 · 0 comments

Comments

@derkork
Copy link
Owner

derkork commented Oct 6, 2022

When using the maven plugin, the generated sources are only added to the normal compile path. If you want to generate test sources though, then these will not be added to the test compile path. The mojo would need to call addTestCompileSourceRoot instead of addCompileSourceRoot in this case. A workaround is to manually add the source root like this:

            <plugin>
                <groupId>com.ancientlightstudios</groupId>
                <artifactId>simplegen-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>generate-test-client</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <configFileName>config-test.yml</configFileName>
                            <outputDirectory>${project.build.directory}/generated-test-sources/simplegen</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.9.1</version>
                <executions>
                    <execution>
                        <id>add-test-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-test-sources/simplegen</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
@derkork derkork closed this as completed in 3069020 Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant