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

Support / example of applying Jabel only to main code on jdk8 and having test code run/compile on jdk13 #36

Open
astubbs opened this issue Aug 12, 2020 · 2 comments

Comments

@astubbs
Copy link

astubbs commented Aug 12, 2020

As described here: https://stackoverflow.com/questions/1213897/different-maven-compiler-versions-for-test-and-main

An example would be great to include in the instructions.

@astubbs
Copy link
Author

astubbs commented Aug 12, 2020

I appear to have it working via adding two different executions as per the stack over flow question:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <!-- jabel setup-->
                        <path>
                            <groupId>com.github.bsideup.jabel</groupId>
                            <artifactId>jabel-javac-plugin</artifactId>
                            <version>0.2.0</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <configuration>
                            <!-- jabel setup -->
                            <!-- Make sure we're not using Java 9+ APIs - restricts JDK APIs to those in 8 -->
                            <release>8</release>
                            <annotationProcessors>
                                <annotationProcessor>com.github.bsideup.jabel.JabelJavacProcessor</annotationProcessor>
                                <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
                            </annotationProcessors>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <configuration>
                            <release>13</release>
<!-- only run Lombok, don't use Jabel on test classes -->
                            <annotationProcessors>
                              <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
                            </annotationProcessors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

@astubbs
Copy link
Author

astubbs commented Aug 13, 2020

FYI I've moved away from this now, and am instead compiling everything on 13, targeting 8, but running fail safe multiple times on different jvms.

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