{"id":375219,"date":"2024-05-21T06:19:06","date_gmt":"2024-05-21T06:19:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=375219"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=375219","title":{"rendered":"<span>Kotlin + Maven toolchain<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0441\u0442\u0430\u0442\u044c\u0438 &#8212; \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u042d\u0422\u041e (kotlin &amp; maven toolchain) \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435. \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f Maven toolchain \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u043d\u0435 \u0445\u043e\u0447\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0443 \u0441 \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0438. \u041a\u0430\u043a \u043a\u043e\u0442\u043b\u0438\u043d\u0438\u0441\u0442\u0443, \u043c\u043d\u0435 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 java \u043a\u0430\u043a-\u0442\u043e \u043f\u043e \u0431\u043e\u043a\u0443, \u043d\u043e \u0442\u0443\u0442 \u0432 JDK 22 \u043f\u043e\u0434\u044a\u0435\u0445\u0430\u043b\u0430 \u0433\u043e\u0434\u043d\u043e\u0442\u0430 &#8212; panama\/foreign \u0432\u044b\u0448\u043b\u0430 \u0438\u0437 \u0438\u043d\u043a\u0443\u0431\u0430\u0442\u043e\u0440\u0430. \u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u043d\u0435 \u0432 \u0442\u0435\u043c\u0435, \u044d\u0442\u0430 \u0444\u0438\u0447\u0430 \u0434\u0430\u0435\u0442 \u0432\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u0437 &#8216;\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438&#8217; dll\/so (\u043f\u0440\u044f\u043c\u043e \u0438\u0437 java \u043a\u043e\u0434\u0430). \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u0430\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043e Maven toolchain.<\/p>\n<p>\u042d\u0442\u0430 \u0444\u0438\u0447\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e jdk (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432) \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0414\u043e \u0430\u043f\u0440\u0435\u043b\u044f 2024 \u0433\u043e\u0434\u0430 maven toolchain \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u044b\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u0430\u0431\u0435\u043d\u044c\u043a\u0438\u0439 (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 gradle toolchains) &#8212; \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c toolchain\/jdk \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 <\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u043d\u0435\u0434\u0430\u0432\u043d\u043e (\u0432 \u0430\u043f\u0440\u0435\u043b\u0435 2024) \u043f\u043e\u0434\u044a\u0435\u0445\u0430\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442<\/p>\n<ul>\n<li>\n<p>$home\/.m2\/toolchains.xml \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 JDK ($JAVA_HOME), \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c<\/p>\n<\/li>\n<li>\n<p>\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, C:\/Program Files\/&#8230;)<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043d\u0430 Windows &#8212; \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041a\u0430\u043a\u043e\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0436\u0430\u0431\u044b \u0432 Linux &#8212; \u043d\u0435 \u0438\u043c\u0435\u044e \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0432\u0435\u0441\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 JAVA_XXX_HOME (\u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: JAVA11_HOME, JAVA22_HOME). \u041f\u0430\u0442\u0442\u0435\u0440\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c.<\/p>\n<ul>\n<li>\n<p>\u041c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0447\u0438\u043c, gradle toolchains \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434, \u043d\u043e \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/toolchains\/custom.html\" rel=\"noopener noreferrer nofollow\"><u>custom toolchains<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 maven toolchain \u0434\u0430\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u0430 \u0438\u0437 gradle. \u0412 gradle \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u0430\u0433 \u043f\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e vendor (\u0438 \u0434\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432) \u0438\u0437 $home\/.m2\/toolchains.xml, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u044c Oracle (standard) JDK \u043e\u0442 Oracle Graal JDK.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443.<\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043a\u0430 &#8212; maven kotlin plugin \u043d\u0435 \u0434\u0440\u0443\u0436\u0438\u0442 \u0441 maven toolchain plugin. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043a\u0430\u043a \u0435\u043c\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u043b\u0441\u044f.<\/p>\n<p>\u041d\u043e&#8230; \u0443 maven kotlin plugin \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 jdkHome, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0430\u043f\u0438\u0442\u0441\u044f \u043d\u0430 maven property &#171;toolchain.jdk.version&#187;. \u042d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0441\u043f\u0430\u0441\u0435\u043d\u0438\u0435\u043c &#8212; \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c JDK home, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 toolchain plugin \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e. \u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 +- \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 (\u0432\u0435\u0441\u044c \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043c\u0435\u0449\u0435\u043d \u0432 try\/catch), \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0432\u0430\u0448 \u0432\u044b\u0431\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 \u0435\u0433\u043e \u0432 production, \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0412 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043e\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0435\u0441\u044c \u043a \u0441\u0442\u0430\u0440\u043e\u0439 \u0434\u043e\u0431\u0440\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 JAVA_HOME.<\/p>\n<pre><code class=\"xml\">&lt;project>     ...     &lt;properties>         &lt;!-- Required JDK version in maven-artifact format. -->         &lt;toolchain.jdk.version>[22,)&lt;\/toolchain.jdk.version>          &lt;!-- Required java-version in numeric format. -->         &lt;java.version>22&lt;\/java.version>         &lt;java.release>${java.version}&lt;\/java.release>         &lt;kotlin.version>1.7.0&lt;\/kotlin.version>         &lt;kotlin.compiler.languageVersion>1.7&lt;\/kotlin.compiler.languageVersion>          &lt;kotlin.compiler.jvmTarget>15&lt;\/kotlin.compiler.jvmTarget>         &lt;kotlin.compiler.incremental>true&lt;\/kotlin.compiler.incremental>          &lt;kotlin-maven-plugin.version>${kotlin.version}&lt;\/kotlin-maven-plugin.version>     &lt;\/properties>      &lt;build>         &lt;plugins>             &lt;plugin>               &lt;groupId>org.apache.maven.plugins&lt;\/groupId>               &lt;artifactId>maven-toolchains-plugin&lt;\/artifactId>               &lt;version>3.2.0&lt;\/version>               &lt;executions>                 &lt;execution>                   &lt;goals>                     &lt;goal>select-jdk-toolchain&lt;\/goal>                   &lt;\/goals>                 &lt;\/execution>               &lt;\/executions>               &lt;configuration>                 &lt;version>${toolchain.jdk.version}&lt;\/version>                 &lt;!-- Optional old config. Let's keep it to avoid IDEA warning. -->                 &lt;toolchains>                   &lt;jdk>                     &lt;version>${toolchain.jdk.version}&lt;\/version>                   &lt;\/jdk>                 &lt;\/toolchains>               &lt;\/configuration>             &lt;\/plugin>                          &lt;plugin>               &lt;groupId>org.codehaus.mojo&lt;\/groupId>               &lt;artifactId>build-helper-maven-plugin&lt;\/artifactId>               &lt;version>3.4.0&lt;\/version>               &lt;executions>                 &lt;execution>                   &lt;id>use-maven-toolchain-jdk-for-kotlin&lt;\/id>                   &lt;goals>                     &lt;goal>bsh-property&lt;\/goal>                   &lt;\/goals>                   &lt;configuration>                     &lt;source>&lt;![CDATA[                       import org.apache.maven.plugin.descriptor.PluginDescriptor;                                    String toolChainJdk = null;                                    try {                         PluginDescriptor pd = new PluginDescriptor();                         pd.setGroupId(\"org.apache.maven.plugins\");                         pd.setArtifactId(\"maven-toolchains-plugin\");                                      Map pluginContext = session.getPluginContext(pd, project);                         if (pluginContext == null)                           throw new IllegalStateException(\"maven-toolchains-plugin plugin context is not found. Probably it is not set up.\");                                      \/\/ A bit risky part of code: I'm not 100% sure that this class will be used in the future.                         \/\/ It is not specified in the org.apache.maven.model.ConfigurationContainer                         \/\/ (there is just java.lang.Object, but it must be some DOM)                                      Object toolchainPluginContext = pluginContext.get(\"toolchain-jdk\");                         if (toolchainPluginContext != null) {                           \/\/ We can use type Object in bean-shell script instead of Xpp3Dom.                           \/\/ Real type is XML DOM object (currently type is org.codehaus.plexus.util.xml.Xpp3Dom class)                                        Object config = toolchainPluginContext.getConfiguration();                           if (config != null &amp;&amp; config.getChildCount() > 0)                             toolChainJdk = config.getChild(0).getValue().trim();                         }                       } catch (Exception ex) {                         log.error(\"toolchain-jdk is not found. \" + ex.getMessage(), ex);                                      \/\/ Or we can rethrow error just there.                         \/\/ throw new IllegalStateException(\"toolchain-jdk is not found.\", ex);                       }                                    String requiredJdkVersion = project.getProperties().getProperty(\"toolchain.jdk.version\");                       if (toolChainJdk != null &amp;&amp; !toolChainJdk.isEmpty()) {                         project.getProperties().setProperty(\"kotlin.compiler.jdkHome\", toolChainJdk);                                      log.info(\"toolchain-jdk for version '\" + requiredJdkVersion + \"' is \" + toolChainJdk);                         log.info(\"It will be used for kotlin compiler\");                       }                       else {                         String currentJavaHome = System.getProperty(\"java.home\");                                      log.info(\"toolchain-jdk for version '\" + requiredJdkVersion + \"' is not found.\");                         log.info(\"  Possible reasons\");                         log.info(\"    * default java_home matches required java version \");                         log.info(\"    * maven-toolchains-plugin is not configured properly\");                         log.info(\"  \");                         log.info(\"Default \" + currentJavaHome + \" will be used.\");                       }                                    ]]&gt;                     &lt;\/source>                   &lt;\/configuration>                 &lt;\/execution>               &lt;\/executions>             &lt;\/plugin>                  &lt;\/plugins>     &lt;\/build> &lt;\/project> <\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/odisseylm\/kotlin-with-maven-toolchain\" rel=\"noopener noreferrer nofollow\"><u>github<\/u><\/a><\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/p>\n<ul>\n<li>\n<p>Maven Toolchains Plugin <a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/\" rel=\"noopener noreferrer nofollow\"><u>home<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/toolchains\/jdk-discovery.html\" rel=\"noopener noreferrer nofollow\"><u>JDK Toolchain discovery mechanism<\/u><\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/select-jdk-toolchain-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:select-jdk-toolchain<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/display-discovered-jdk-toolchains-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:display-discovered-jdk-toolchains<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/generate-jdk-toolchains-xml-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:generate-jdk-toolchains-xml<\/u><\/a><\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0430\u0440\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u043b\u0430\u0431\u0435\u043d\u044c\u043a\u0438\u0439 <a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/toolchain-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:toolchain<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/help-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:help<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins-archives\/maven-toolchains-plugin-LATEST\/select-jdk-toolchain-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/u><\/a>\u00a0 (\u0438\u043b\u0438 \u0441\u044b\u0440\u0446\u044b SelectJdkToolchainMojo)<\/p>\n<\/li>\n<li>\n<p>On mojohaus<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/www.mojohaus.org\/exec-maven-plugin\/examples\/example-exec-using-toolchains.html\" rel=\"noopener noreferrer nofollow\"><u>Using Toolchains Instead of Explicit Paths<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/sdkman.io\/\" rel=\"noopener noreferrer nofollow\"><u>SDKMAN<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/811787\/\"> https:\/\/habr.com\/ru\/articles\/811787\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0441\u0442\u0430\u0442\u044c\u0438 &#8212; \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u042d\u0422\u041e (kotlin &amp; maven toolchain) \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435. \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f Maven toolchain \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u043d\u0435 \u0445\u043e\u0447\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0443 \u0441 \u043f\u0440\u0435\u043b\u044e\u0434\u0438\u0438. \u041a\u0430\u043a \u043a\u043e\u0442\u043b\u0438\u043d\u0438\u0441\u0442\u0443, \u043c\u043d\u0435 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 java \u043a\u0430\u043a-\u0442\u043e \u043f\u043e \u0431\u043e\u043a\u0443, \u043d\u043e \u0442\u0443\u0442 \u0432 JDK 22 \u043f\u043e\u0434\u044a\u0435\u0445\u0430\u043b\u0430 \u0433\u043e\u0434\u043d\u043e\u0442\u0430 &#8212; panama\/foreign \u0432\u044b\u0448\u043b\u0430 \u0438\u0437 \u0438\u043d\u043a\u0443\u0431\u0430\u0442\u043e\u0440\u0430. \u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u043d\u0435 \u0432 \u0442\u0435\u043c\u0435, \u044d\u0442\u0430 \u0444\u0438\u0447\u0430 \u0434\u0430\u0435\u0442 \u0432\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u0437 &#8216;\u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438&#8217; dll\/so (\u043f\u0440\u044f\u043c\u043e \u0438\u0437 java \u043a\u043e\u0434\u0430). \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0430\u043c\u0438, \u0430 \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0432\u0430\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>\u0412\u043a\u0440\u0430\u0442\u0446\u0435 \u043e Maven toolchain.<\/p>\n<p>\u042d\u0442\u0430 \u0444\u0438\u0447\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e jdk (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432) \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0414\u043e \u0430\u043f\u0440\u0435\u043b\u044f 2024 \u0433\u043e\u0434\u0430 maven toolchain \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u044b\u043b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u0430\u0431\u0435\u043d\u044c\u043a\u0438\u0439 (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 gradle toolchains) &#8212; \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c toolchain\/jdk \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 <\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u043d\u0435\u0434\u0430\u0432\u043d\u043e (\u0432 \u0430\u043f\u0440\u0435\u043b\u0435 2024) \u043f\u043e\u0434\u044a\u0435\u0445\u0430\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442<\/p>\n<ul>\n<li>\n<p>$home\/.m2\/toolchains.xml \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 JDK ($JAVA_HOME), \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c<\/p>\n<\/li>\n<li>\n<p>\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, C:\/Program Files\/&#8230;)<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043d\u0430 Windows &#8212; \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041a\u0430\u043a\u043e\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0436\u0430\u0431\u044b \u0432 Linux &#8212; \u043d\u0435 \u0438\u043c\u0435\u044e \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0432\u0435\u0441\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 JAVA_XXX_HOME (\u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: JAVA11_HOME, JAVA22_HOME). \u041f\u0430\u0442\u0442\u0435\u0440\u043d \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c.<\/p>\n<ul>\n<li>\n<p>\u041c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0447\u0438\u043c, gradle toolchains \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434, \u043d\u043e \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/toolchains\/custom.html\" rel=\"noopener noreferrer nofollow\"><u>custom toolchains<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 maven toolchain \u0434\u0430\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u0430 \u0438\u0437 gradle. \u0412 gradle \u0435\u0441\u0442\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u0430\u0433 \u043f\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e vendor (\u0438 \u0434\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432) \u0438\u0437 $home\/.m2\/toolchains.xml, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u044c Oracle (standard) JDK \u043e\u0442 Oracle Graal JDK.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443.<\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043a\u0430 &#8212; maven kotlin plugin \u043d\u0435 \u0434\u0440\u0443\u0436\u0438\u0442 \u0441 maven toolchain plugin. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043a\u0430\u043a \u0435\u043c\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u043b\u0441\u044f.<\/p>\n<p>\u041d\u043e&#8230; \u0443 maven kotlin plugin \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 jdkHome, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0430\u043f\u0438\u0442\u0441\u044f \u043d\u0430 maven property &#171;toolchain.jdk.version&#187;. \u042d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0441\u043f\u0430\u0441\u0435\u043d\u0438\u0435\u043c &#8212; \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c JDK home, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 toolchain plugin \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e. \u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 +- \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0435 (\u0432\u0435\u0441\u044c \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043c\u0435\u0449\u0435\u043d \u0432 try\/catch), \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0432\u0430\u0448 \u0432\u044b\u0431\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 \u0435\u0433\u043e \u0432 production, \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0412 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043e\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0435\u0441\u044c \u043a \u0441\u0442\u0430\u0440\u043e\u0439 \u0434\u043e\u0431\u0440\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 JAVA_HOME.<\/p>\n<pre><code class=\"xml\">&lt;project>     ...     &lt;properties>         &lt;!-- Required JDK version in maven-artifact format. -->         &lt;toolchain.jdk.version>[22,)&lt;\/toolchain.jdk.version>          &lt;!-- Required java-version in numeric format. -->         &lt;java.version>22&lt;\/java.version>         &lt;java.release>${java.version}&lt;\/java.release>         &lt;kotlin.version>1.7.0&lt;\/kotlin.version>         &lt;kotlin.compiler.languageVersion>1.7&lt;\/kotlin.compiler.languageVersion>          &lt;kotlin.compiler.jvmTarget>15&lt;\/kotlin.compiler.jvmTarget>         &lt;kotlin.compiler.incremental>true&lt;\/kotlin.compiler.incremental>          &lt;kotlin-maven-plugin.version>${kotlin.version}&lt;\/kotlin-maven-plugin.version>     &lt;\/properties>      &lt;build>         &lt;plugins>             &lt;plugin>               &lt;groupId>org.apache.maven.plugins&lt;\/groupId>               &lt;artifactId>maven-toolchains-plugin&lt;\/artifactId>               &lt;version>3.2.0&lt;\/version>               &lt;executions>                 &lt;execution>                   &lt;goals>                     &lt;goal>select-jdk-toolchain&lt;\/goal>                   &lt;\/goals>                 &lt;\/execution>               &lt;\/executions>               &lt;configuration>                 &lt;version>${toolchain.jdk.version}&lt;\/version>                 &lt;!-- Optional old config. Let's keep it to avoid IDEA warning. -->                 &lt;toolchains>                   &lt;jdk>                     &lt;version>${toolchain.jdk.version}&lt;\/version>                   &lt;\/jdk>                 &lt;\/toolchains>               &lt;\/configuration>             &lt;\/plugin>                          &lt;plugin>               &lt;groupId>org.codehaus.mojo&lt;\/groupId>               &lt;artifactId>build-helper-maven-plugin&lt;\/artifactId>               &lt;version>3.4.0&lt;\/version>               &lt;executions>                 &lt;execution>                   &lt;id>use-maven-toolchain-jdk-for-kotlin&lt;\/id>                   &lt;goals>                     &lt;goal>bsh-property&lt;\/goal>                   &lt;\/goals>                   &lt;configuration>                     &lt;source>&lt;![CDATA[                       import org.apache.maven.plugin.descriptor.PluginDescriptor;                                    String toolChainJdk = null;                                    try {                         PluginDescriptor pd = new PluginDescriptor();                         pd.setGroupId(\"org.apache.maven.plugins\");                         pd.setArtifactId(\"maven-toolchains-plugin\");                                      Map pluginContext = session.getPluginContext(pd, project);                         if (pluginContext == null)                           throw new IllegalStateException(\"maven-toolchains-plugin plugin context is not found. Probably it is not set up.\");                                      \/\/ A bit risky part of code: I'm not 100% sure that this class will be used in the future.                         \/\/ It is not specified in the org.apache.maven.model.ConfigurationContainer                         \/\/ (there is just java.lang.Object, but it must be some DOM)                                      Object toolchainPluginContext = pluginContext.get(\"toolchain-jdk\");                         if (toolchainPluginContext != null) {                           \/\/ We can use type Object in bean-shell script instead of Xpp3Dom.                           \/\/ Real type is XML DOM object (currently type is org.codehaus.plexus.util.xml.Xpp3Dom class)                                        Object config = toolchainPluginContext.getConfiguration();                           if (config != null &amp;&amp; config.getChildCount() > 0)                             toolChainJdk = config.getChild(0).getValue().trim();                         }                       } catch (Exception ex) {                         log.error(\"toolchain-jdk is not found. \" + ex.getMessage(), ex);                                      \/\/ Or we can rethrow error just there.                         \/\/ throw new IllegalStateException(\"toolchain-jdk is not found.\", ex);                       }                                    String requiredJdkVersion = project.getProperties().getProperty(\"toolchain.jdk.version\");                       if (toolChainJdk != null &amp;&amp; !toolChainJdk.isEmpty()) {                         project.getProperties().setProperty(\"kotlin.compiler.jdkHome\", toolChainJdk);                                      log.info(\"toolchain-jdk for version '\" + requiredJdkVersion + \"' is \" + toolChainJdk);                         log.info(\"It will be used for kotlin compiler\");                       }                       else {                         String currentJavaHome = System.getProperty(\"java.home\");                                      log.info(\"toolchain-jdk for version '\" + requiredJdkVersion + \"' is not found.\");                         log.info(\"  Possible reasons\");                         log.info(\"    * default java_home matches required java version \");                         log.info(\"    * maven-toolchains-plugin is not configured properly\");                         log.info(\"  \");                         log.info(\"Default \" + currentJavaHome + \" will be used.\");                       }                                    ]]&gt;                     &lt;\/source>                   &lt;\/configuration>                 &lt;\/execution>               &lt;\/executions>             &lt;\/plugin>                  &lt;\/plugins>     &lt;\/build> &lt;\/project> <\/code><\/pre>\n<p>\u041f\u043e\u043b\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/odisseylm\/kotlin-with-maven-toolchain\" rel=\"noopener noreferrer nofollow\"><u>github<\/u><\/a><\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/p>\n<ul>\n<li>\n<p>Maven Toolchains Plugin <a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/\" rel=\"noopener noreferrer nofollow\"><u>home<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/toolchains\/jdk-discovery.html\" rel=\"noopener noreferrer nofollow\"><u>JDK Toolchain discovery mechanism<\/u><\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/select-jdk-toolchain-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:select-jdk-toolchain<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/display-discovered-jdk-toolchains-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:display-discovered-jdk-toolchains<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/generate-jdk-toolchains-xml-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:generate-jdk-toolchains-xml<\/u><\/a><\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0430\u0440\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u043b\u0430\u0431\u0435\u043d\u044c\u043a\u0438\u0439 <a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/toolchain-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:toolchain<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins\/maven-toolchains-plugin\/help-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>toolchains:help<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/maven.apache.org\/plugins-archives\/maven-toolchains-plugin-LATEST\/select-jdk-toolchain-mojo.html\" rel=\"noopener noreferrer nofollow\"><u>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/u><\/a>\u00a0 (\u0438\u043b\u0438 \u0441\u044b\u0440\u0446\u044b SelectJdkToolchainMojo)<\/p>\n<\/li>\n<li>\n<p>On mojohaus<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/www.mojohaus.org\/exec-maven-plugin\/examples\/example-exec-using-toolchains.html\" rel=\"noopener noreferrer nofollow\"><u>Using Toolchains Instead of Explicit Paths<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/sdkman.io\/\" rel=\"noopener noreferrer nofollow\"><u>SDKMAN<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/811787\/\"> https:\/\/habr.com\/ru\/articles\/811787\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-375219","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=375219"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375219\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=375219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=375219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=375219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}