Уже давным давно вышла Java8, но мир намного многограннее, чем думают в Oracle и многим требуется писать код основного проекта на 6 и 7 версиях Java.
А вот писать тесты в таком проекте очень хочется, и хочется лямбд, функциональных интерфейсов и вот этого всего.
Выход есть и вот он:
1. Ставим java8 на ваш сервер CI и локально
2. В pom.xml прописываем вот такую вот конфигурацию плагина для компиляции
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.1</version> | |
<configuration> | |
<source>1.7</source> | |
<target>1.7</target> | |
<testSource>1.8</testSource> | |
<testTarget>1.8</testTarget> | |
</configuration> | |
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compileJava { | |
sourceCompatibility = '1.7' | |
} | |
compileTestJava { | |
sourceCompatibility = '1.8' | |
} |
Комментариев нет:
Отправить комментарий