This simple project demonstrates warning messages generated by the kotlin-maven-plugin when running scripts.
Virtually identical to https://github.com/JetBrains/kotlin/blob/1.7.20/libraries/tools/kotlin-maven-plugin-test/src/it/test-executeKotlinScriptInline/pom.xml. (I just hard-coded kotlin.version and added Maven Wrapper.)
On a Mac, the warning [WARNING] Script '*.tmp.kts' is not supposed to be used along with regular Kotlin sources, and will be ignored in the future versions by default. (Use -Xallow-any-scripts-in-source-roots command line option to opt-in for the old behavior.) is logged:
$ java --version
openjdk 18 2022-03-22
OpenJDK Runtime Environment Zulu18.28+13-CA (build 18+37)
OpenJDK 64-Bit Server VM Zulu18.28+13-CA (build 18+37, mixed mode, sharing)
$ ./mvnw --version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T04:41:47+10:00)
Maven home: /Users/sean/.m2/wrapper/dists/apache-maven-3.6.0-bin/ce9a2734/apache-maven-3.6.0
Java version: 18, vendor: Azul Systems, Inc., runtime: /Users/sean/Library/Java/JavaVirtualMachines/azul-18/Contents/Home
Default locale: en_AU, platform encoding: UTF-8
OS name: "mac os x", version: "12.5.1", arch: "aarch64", family: "mac"
$ ./mvnw compile
[INFO] Scanning for projects...
[INFO]
[INFO] --------< org.jetbrains.kotlin:test-executeKotlinScriptInline >---------
[INFO] Building test-executeKotlinScriptInline 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test-executeKotlinScriptInline ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/sean/Documents/GitHub/kotlin-script-test-20221014/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test-executeKotlinScriptInline ---
[INFO] No sources to compile
[INFO]
[INFO] --- kotlin-maven-plugin:1.7.20:script (execute-kotlin-script) @ test-executeKotlinScriptInline ---
[WARNING] Script 'kotlin-maven-plugin-inline-script-6024864228292880009.tmp.kts' is not supposed to be used along with regular Kotlin sources, and will be ignored in the future versions by default. (Use -Xallow-any-scripts-in-source-roots command line option to opt-in for the old behavior.)
Hello from inline Kotlin script!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.572 s
[INFO] Finished at: 2022-10-14T22:36:19+10:00
[INFO] ------------------------------------------------------------------------
And on Windows 10:
$ ./mvnw --version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T04:41:47+10:00)
Maven home: C:\Users\Sean\.m2\wrapper\dists\apache-maven-3.6.0-bin\ce9a2734\apache-maven-3.6.0
Java version: 1.8.0_292, vendor: Azul Systems, Inc., runtime: D:\apps\zulu8.54.0.21-ca-jdk8.0.292-win_x64\jre
Default locale: en_AU, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
$ ./mvnw compile
[INFO] Scanning for projects...
[INFO]
[INFO] --------< org.jetbrains.kotlin:test-executeKotlinScriptInline >---------
[INFO] Building test-executeKotlinScriptInline 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test-executeKotlinScriptInline ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\script-test-20221014\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test-executeKotlinScriptInline ---
[INFO] No sources to compile
[INFO]
[INFO] --- kotlin-maven-plugin:1.7.20:script (execute-kotlin-script) @ test-executeKotlinScriptInline ---
WARN: Failed to initialize native filesystem for Windows
java.lang.RuntimeException: Could not find installation home path. Please make sure bin/idea.properties is present in the installation directory.
at com.intellij.openapi.application.PathManager.getHomePath(PathManager.java:105)
at com.intellij.openapi.application.PathManager.getBinDirectories(PathManager.java:127)
at com.intellij.openapi.application.PathManager.findBinFile(PathManager.java:215)
at com.intellij.util.loader.NativeLibraryLoader.loadPlatformLibrary(NativeLibraryLoader.java:21)
at com.intellij.openapi.util.io.win32.IdeaWin32.<clinit>(IdeaWin32.java:33)
at com.intellij.openapi.util.io.FileSystemUtil.computeMediator(FileSystemUtil.java:54)
at com.intellij.openapi.util.io.FileSystemUtil.<clinit>(FileSystemUtil.java:49)
at com.intellij.openapi.vfs.impl.ZipHandler.setFileAttributes(ZipHandler.java:48)
at com.intellij.openapi.vfs.impl.ZipHandler$1.createAccessor(ZipHandler.java:30)
at com.intellij.openapi.vfs.impl.ZipHandler$1.createAccessor(ZipHandler.java:25)
at com.intellij.util.io.FileAccessorCache.createHandle(FileAccessorCache.java:62)
at com.intellij.util.io.FileAccessorCache.get(FileAccessorCache.java:55)
at com.intellij.openapi.vfs.impl.ZipHandler.getCachedZipFileHandle(ZipHandler.java:70)
at com.intellij.openapi.vfs.impl.ZipHandler.acquireZipHandle(ZipHandler.java:117)
at com.intellij.openapi.vfs.impl.ZipHandlerBase.createEntriesMap(ZipHandlerBase.java:38)
at com.intellij.openapi.vfs.impl.ArchiveHandler.getEntriesMap(ArchiveHandler.java:179)
at com.intellij.openapi.vfs.impl.jar.CoreJarHandler.<init>(CoreJarHandler.java:42)
at com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem.lambda$new$0(CoreJarFileSystem.java:33)
at com.intellij.util.containers.ConcurrentFactoryMap$2.create(ConcurrentFactoryMap.java:174)
at com.intellij.util.containers.ConcurrentFactoryMap.get(ConcurrentFactoryMap.java:40)
at com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem.findFileByPath(CoreJarFileSystem.java:44)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.findJarRoot(KotlinCoreEnvironment.kt:406)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.contentRootToVirtualFile(KotlinCoreEnvironment.kt:384)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.access$contentRootToVirtualFile(KotlinCoreEnvironment.kt:108)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$2.invoke(KotlinCoreEnvironment.kt:231)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$2.invoke(KotlinCoreEnvironment.kt:108)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:76)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:240)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:108)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:445)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.createForProduction(KotlinCoreEnvironment.kt)
at org.jetbrains.kotlin.maven.ExecuteKotlinScriptMojo.executeScriptFile(ExecuteKotlinScriptMojo.java:198)
at org.jetbrains.kotlin.maven.ExecuteKotlinScriptMojo.executeScriptInline(ExecuteKotlinScriptMojo.java:149)
at org.jetbrains.kotlin.maven.ExecuteKotlinScriptMojo.execute(ExecuteKotlinScriptMojo.java:131)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:53)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:152)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:76)
[WARNING] Script 'kotlin-maven-plugin-inline-script-5186067317018444187.tmp.kts' is not supposed to be used along with regular Kotlin sources, and will be ignored in the future versions by default.
(Use -Xallow-any-scripts-in-source-roots command line option to opt-in for the old behavior.)
Hello from inline Kotlin script!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.148 s
[INFO] Finished at: 2022-10-14T22:19:29+10:00
[INFO] ------------------------------------------------------------------------
Contributors
Created October 14, 2022
Updated October 15, 2022