[deepamehta-devel] using Java8 lambda expression in DM plugins

Robert Schuster robert.schuster.rs01 at gmail.com
Fri Jun 23 19:47:54 CEST 2017


Hi everybody,

maybe someone played with the idea of using Java8 lambda expressions in
DM plugins and failed because Apache Felix does not like class files
with those. However there is a solution! Just drop the following into
your project POM:

            <plugin>
                <groupId>net.orfjackal.retrolambda</groupId>
                <artifactId>retrolambda-maven-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>process-main</goal>
                            <goal>process-test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <target>1.6</target>
                    <defaultMethods>true</defaultMethods>
                </configuration>
              </plugin>

Then set source and class file level to 1.8 and all is set.

What happens is that the class files will be processed with retrolambda
which translates the binary lambda expression data back into something
that is Java6 (and thusly Felix) compatible.

All the best,
Robert

-- 
Robert Schuster
freiberuflicher Softwareingenieur

RS01 - IT-Systemanalyse und -entwicklung Robert Schuster
Kalkbergeweg 75 • 12589 Berlin
+49 157 798 00 310
robert.schuster.rs01 at gmail.com



More information about the devel mailing list