I want to produce a Java 8 compatible library that provides some Java 9+ classes, packaged as a Multi-Release JAR:

 * https://maven.apache.org/plugins/maven-compiler-plugin/multirelease.html

I've taken a slimmed down _Multi-Release Parent_ <http://www.russgold.net/sw/2018/04/easier-than-it-looks/> approach, and the main compilation and packaging seems just right:

    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
        <configuration>
            <source>8</source>
            <target>8</target>
        </configuration>
        <executions>
            <execution>
                <id>compile-java9</id>
                <phase>compile</phase>
                <goals>
                    <goal>compile</goal>
                </goals>
                <configuration>
                    <release>9</release>
                    <jdkToolchain>
                        <version>9</version>
                    </jdkToolchain>
                    <compileSourceRoots>
                        
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
                    </compileSourceRoots>
                    <multiReleaseOutput>true</multiReleaseOutput>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.2</version>
        <configuration>
            <archive>
                <manifestEntries>
                    <Multi-Release>true</Multi-Release>
                </manifestEntries>
            </archive>
        </configuration>
    </plugin>

Now I've added some test sources exercising the Java 9+ only classes, but the `testCompile` goal seems unable to find them.  Is it possible to configure the `default-testCompile` execution to see the classes from the `multiReleaseOutput` of the main compile?

FWIW, my current work-in-progress could be seen at:

 * https://github.com/stanio/xbrz-java/commit/8c9564ee874

--
Stanimir


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to