Giter VIP home page Giter VIP logo

kotlin-plugin's Introduction

kotlin-plugin

Build Status

Build kotlin code using sbt

Current version 2.0.0

Usage

  • for sbt 1.0.0+ addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "2.0.0")
  • for sbt 0.13.x addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "1.0.9")
  • Kotlin code will build automatically from src/XXX/kotlin
  • If necessary, add kotlinLib("stdlib"), it is not included by default.
    • Loading standard kotlin libraries and plugins: use kotlinLib(NAME) as above to load standard kotlin modules provided by JetBrains. For JetBrains kotlin compiler plugins, use kotlinPlugin(NAME) (e.g. kotlinPlugin("android-extensions")). The difference is that the latter marks the module as a compile-internal dependency and will be excluded from the final build product.
    • Any other libraries can be loaded using the normal libraryDependencies mechanism. Compiler plugins should be added as a normal libraryDependency but specified to be % "compile-internal"
  • If a non-standard Classpath key needs to be added to the kotlin compile step, it can be added using the kotlinClasspath(KEY) function
    • For example, to compile with the android platform using android-sdk-plugin: kotlinClasspath(Compile, bootClasspath in Android)

Options

  • kotlincPluginOptions: specifies options to pass to kotlin compiler plugins. Use val plugin = KotlinPluginOptions(PLUGINID) and plugin.option(KEY, VALUE) to populate this setting
  • kotlinSource: specifies kotlin source directory, defaults to src/main/kotlin and src/test/kotlin
  • kotlinVersion: specifies versions of kotlin compiler and libraries to use, defaults to 1.3.41
  • kotlinLib(LIB): load a standard kotlin library, for example kotlinLib("stdlib"); the library will utilize the version specified in kotlinVersion plugin
  • kotlincOptions: options to pass to the kotlin compiler

Examples

Limitations

  • currently requires kotlin 1.1.4+

kotlin-plugin's People

Contributors

abond avatar alexvanolst avatar darkyenus avatar jeffboutotte avatar kpritam avatar pfn avatar seroperson avatar tonilopezmr avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kotlin-plugin's Issues

kotlinPluginOptions not working

I want to use plugins allopen and noarg to define some annotations to open classes. But plugin options don't work and at runtime spring will throw error that class XXX may not be final.

sbt.build configs:

    val annotation = "annotation"
    kotlinPlugin("allopen")
    kotlincPluginOptions in Compile ++= {
      val plugin = KotlinPluginOptions("org.jetbrains.kotlin.plugin.allopen")
      plugin.option(annotation, "javax.inject.Inject") ::
        plugin.option(annotation, "javax.inject.Singleton") ::
        plugin.option(annotation, "javax.persistence.Entity") ::
        plugin.option(annotation, "org.springframework.context.annotation.Configuration") ::
        plugin.option(annotation, "org.springframework.stereotype.Component") ::
        plugin.option(annotation, "org.springframework.scheduling.annotation.Async") ::
        plugin.option(annotation, "org.springframework.transaction.annotation.Transactional") ::
        plugin.option(annotation, "org.springframework.cache.annotation.Cacheable") ::
        Nil
    }

    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-noarg
    kotlinPlugin("noarg")
    val noArgPlugin = KotlinPluginOptions("org.jetbrains.kotlin.plugin.noarg")
    kotlincPluginOptions in Compile += noArgPlugin.option(annotation, "javax.persistence.Entity")
    kotlincPluginOptions in Compile += noArgPlugin.option(annotation, "javax.persistence.Embeddable")

Spring runtime error:

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class 'SpringDataJpaModule.SpringDataJpaConfiguration' may not be final. Remove the final modifier to continue.
Offending resource: SpringDataJpaModule$SpringDataJpaConfiguration

You can remove the test limitations

With the new version, we can run any individual test or all the tests using sbt test or sbt "test-only *ClassName"

I have used sbt run and it's working too, I think we should update the limitation section.

using kotlin code in java

I'm trying to integrate kotlin into my java code. I did this previously with scala, where I made scala file and used in java. Now after adding the kotlin plugin, when I make a kotlin class in the same package, the java file can't find it.

Do I need to do anything besides adding the plugin and executing "sbt run"?

Compatibility issue with Kotlin 1.7.0

Hi,

Sadly, the siganture has changed:

[error] java.lang.NoSuchMethodException: org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt.parseCommandLineArguments(java.util.List, org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments)
[error] 	at java.lang.Class.getMethod(Class.java:1786)
[error] 	at kotlin.KotlinStub.parse(KotlinCompile.scala:156)
[error] 	at kotlin.KotlinCompile$.compile(KotlinCompile.scala:37)
[error] 	at kotlin.KotlinPlugin$.$anonfun$kotlinCompileSettings$4(KotlinPlugin.scala:82)
[error] 	at kotlin.KotlinPlugin$.$anonfun$kotlinCompileSettings$4$adapted(KotlinPlugin.scala:78)

Feature request: Support running kotlintest

The plugin currently supports kotlin tests written using JUnit style.

This ticket is to add support for running tests written in kotlintest style like using WordSpec, StringSpec etc.

failed to compile .kts file

I am able to compile .kt files, but compiling .kts script files fails with below exception

tried with
Kotlin Version: 1.3.50 and 1.3.41

sbt:esw-integration-test> kotlinCompile
[info] Compiling 2 Kotlin sources
[error] org.jetbrains.kotlin.util.KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration Sample
[error] File being compiled at position: (1,24) in /Users/pritamkadam/projects/tmtsoftware/esw/esw-integration-test/src/main/kotlin/esw/ocs/scripts/Sample.kts
[error] The root cause org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException was thrown at: org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:18)
[error]         at org.jetbrains.kotlin.resolve.ExceptionWrappingKtVisitorVoid.visitDeclaration(ExceptionWrappingKtVisitorVoid.kt:43)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitDeclaration(KtVisitorVoid.java:453)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitDeclaration(KtVisitorVoid.java:21)
[error]         at org.jetbrains.kotlin.psi.KtVisitor.visitScript(KtVisitor.java:78)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:73)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:519)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:21)
[error]         at org.jetbrains.kotlin.psi.KtScript.accept(KtScript.java:69)
[error]         at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:59)
[error]         at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer$analyzeDeclarations$1.registerDeclarations(LazyTopDownAnalyzer.kt:78)
[error]         at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer$analyzeDeclarations$1.visitKtFile(LazyTopDownAnalyzer.kt:96)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:513)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:21)
[error]         at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:242)
[error]         at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:229)
[error]         at org.jetbrains.kotlin.resolve.ExceptionWrappingKtVisitorVoid.visitElement(ExceptionWrappingKtVisitorVoid.kt:27)
[error]         at org.jetbrains.kotlin.com.intellij.psi.PsiElementVisitor.visitFile(PsiElementVisitor.java:34)
[error]         at org.jetbrains.kotlin.psi.KtVisitor.visitKtFile(KtVisitor.java:73)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:69)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:513)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitKtFile(KtVisitorVoid.java:21)
[error]         at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:242)
[error]         at org.jetbrains.kotlin.psi.KtFile.accept(KtFile.kt:229)
[error]         at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:201)
[error]         at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations$default(LazyTopDownAnalyzer.kt:60)
[error]         at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:111)
[error]         at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:81)
[error]         at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:555)
[error]         at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
[error]         at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
[error]         at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:546)
[error]         at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
[error]         at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
[error]         at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
[error]         at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
[error]         at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
[error]         at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error]         at kotlin.KotlinStub.compile(KotlinCompile.scala:193)
[error]         at kotlin.KotlinCompile$.compile(KotlinCompile.scala:70)
[error]         at kotlin.KotlinPlugin$.$anonfun$kotlinCompileSettings$4(KotlinPlugin.scala:67)
[error]         at kotlin.KotlinPlugin$.$anonfun$kotlinCompileSettings$4$adapted(KotlinPlugin.scala:63)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:280)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error]         at sbt.Execute.work(Execute.scala:289)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:280)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:834)
[error] Caused by: org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException: Descriptor wasn't found for declaration SCRIPT
[error]         at org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:18)
[error]         at org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:17)
[error]         at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.findClassDescriptor(LazyDeclarationResolver.kt:88)
[error]         at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.getScriptDescriptor(LazyDeclarationResolver.kt:65)
[error]         at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer$analyzeDeclarations$1.visitScript(LazyTopDownAnalyzer.kt:89)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:519)
[error]         at org.jetbrains.kotlin.psi.KtVisitorVoid.visitScript(KtVisitorVoid.java:21)
[error]         at org.jetbrains.kotlin.psi.KtScript.accept(KtScript.java:69)
[error]         at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:59)
[error]         at org.jetbrains.kotlin.resolve.ExceptionWrappingKtVisitorVoid.visitDeclaration(ExceptionWrappingKtVisitorVoid.kt:32)
[error]         ... 59 more
[error] Compilation failed. See log for more details
[error] (Compile / kotlinCompile) Compilation failed. See log for more details
[error] Total time: 7 s, completed 26-Sep-2019, 4:44:36 PM

kotlin-scripting-compiler-embeddable added to pom.xml

The pom.xml file generated by projects using this plugin has kotlin-scripting-compiler-embeddable added to the project dependencies. This will cause any projects depending on the published pom to require the Kotlin compiler, which I don't believe it's the intention.

Problem compiling Kotlin 1.1.3-2

Similar to previously raised issue #12 which was resolved in plugin version 1.0.7, the plugin fails to compile when using Kotlin version 1.1.3-2

[error] (/compile:kotlinCompile) Unable to find Args class
[error] (
/compile:kotlinCompile) Compilation failed. See log for more details

2.0.0 package available?

I would like to use this plugin with scala 2.12.x and sbt 1.x.
#27 supported them and but I can't find the package in bintray.
Can I use 2.0.0-SNAPSHOT ?

Update for SBT 1.0, Scala 1.12

I don't know how far this project is still active, but I hope that it is possible to update it to current versions of Scala and SBT

Cannot pass jvmTarget to the compiler

Could you please suggest how I should pass jvmTarget to the compiler? @pfn

I tried

kotlincOptions ++= Seq("-verbose", "-jvm-target 1.8")

and

kotlincOptions ++= Seq("-verbose", "-jvmTarget 1.8")

with no effect.

My .sbt file

import sbt.Keys._
import sbt._

lazy val commonSettings = Seq(
  name := "collections",
  organization := "com.walkmind.extensions",
  version := "1.0",
  licenses := Seq("Apache-2.0" -> url("http://opensource.org/licenses/Apache-2.0")),
  scalaVersion := "2.13.1"
)

lazy val publishSettings = {
  Seq(
    bintrayOrganization := Some("cppexpert"),
    publishArtifact in Test := false,
    publishArtifact := true,

    scmInfo := Some(ScmInfo(url("https://gitlab.com/unoexperto/extensions-collections.git"), "[email protected]:unoexperto/extensions-collections.git")),
    developers += Developer("unoexperto",
      "ruslan",
      "[email protected]",
      url("https://gitlab.com/unoexperto")),
    pomIncludeRepository := (_ => false),
    bintrayPackage := "extensions-collections"
  )
}

lazy val root = (project in file("."))
  .settings(commonSettings: _*)
  .settings(publishSettings: _*)
  .settings(
    compileOrder := CompileOrder.JavaThenScala,
    autoScalaLibrary := false,

    libraryDependencies ++= {
      Seq(
        "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.8" % "provided" withSources(),
        "org.rocksdb" % "rocksdbjni" % "6.3.6" % "provided" withSources(),

        "org.junit.jupiter" % "junit-jupiter-api" % "5.5.2" % Test,
        "io.kotlintest" % "kotlintest-runner-junit5" % "3.4.2" % Test
      )
    },

    // Removing unnecessary dependency
    // https://github.com/pfn/kotlin-plugin/pull/32
    libraryDependencies ~= (_.flatMap { module =>
      if (module.name == "kotlin-scripting-compiler-embeddable")
        Seq.empty
      else
        Seq(module)
    }),

    scalacOptions := Seq("-g:notailcalls", "-release", "8", "-unchecked", "-deprecation", "-encoding", "utf8", "-language:implicitConversions", "-language:postfixOps", "-language:higherKinds", "-Xcheckinit"), //, "-Xlog-implicits"),
    javaOptions in compile ++= Seq("-Xmx2G"),
    javacOptions ++= Seq("-g", "-encoding", "UTF-8", "-source", "8", "-target", "8"), // "--enable-preview"
    crossPaths := false,

    kotlinVersion := "1.3.60",
    kotlincOptions ++= Seq("-verbose", "-jvm-target 1.8"), //,"-XXLanguage:+NewInference" , "-Xinline-classes"),
    kotlinLib("stdlib-jdk8"),

    ivyLoggingLevel := UpdateLogging.Full, // Set Ivy logging to be at the highest level
    logLevel in compile := Level.Warn, // Only show warnings and errors on the screen for compilations. This applies to both test:compile and compile and is Info by default
    logLevel := Level.Warn, // Only show warnings and errors on the screen for all tasks (the default is Info). Individual tasks can then be more verbose using the previous setting
    persistLogLevel := Level.Debug, // Only store messages at info and above (the default is Debug). This is the logging level for replaying logging with 'last'
    traceLevel := 10 // Only show 10 lines of stack traces
  )
  .enablePlugins(DependencyGraphPlugin, KotlinPlugin, BintrayPlugin)

Problem with Kotlin 1.1.2

If i try to use 1.1.2 as KotlinVersion it fails with the following errors:

[error] Unable to find Args class
[error] (root/compile:kotlinCompile) Unable to find Args class

it works well if i use 1.1.1 or the default version. Any idea how to fix it?

Annotation Processing

Kotlin processes annotations slightly different from Java. The Kotlin gradle plugin requires some special syntax for annotation processors (kapt instead of compile). Would annotation processors for Kotlin with this plugin? If so, does anything special need to be done?

kotlinCompileOrder not found

Hello!
When I try to set
kotlinCompileOrder := KotlinCompileOrder.KotlinAfter
I get not found error. Am I doing something wrong, or this option not available now?
Thanks!

Source files getting compiled multiple times

I am using this plugin as part of a Play! Framework project. My source root is app. My application contains 53 Kotlin source files.
When my application compiles it seems that everything gets compiled twice.
Upon starting a build I see the following message:
[info] Compiling 106 Kotlin sources
Followed by:
[warn] Duplicate source root: /Users/matthew/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/APIKeyCheckAction.kt

For every kotlin source in my project. Once the compilation completes, it then starts over and compiles everything again.

I tried changing the kotlinSource to app in the build.sbt. When I do that it then outputs Compiling 159 Kotlin sources.

Prior to adding the plugin and using pure Java I did not have this problem. Here is my full output of a single build. Notice about half way through everything seems to start over:

[info] Compiling 106 Kotlin sources
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/APIKeyCheckAction.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/VersionValidationAction.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/ConfigurationController.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Attachment.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Configurations.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataCollections.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataSets.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Lists.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Login.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Registration.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Router.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Users.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Configurations.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Portal.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DatabaseExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DateTimeExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/JsonExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/RequestExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Activity.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Application.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/AuthenticationInfo.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Branding.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Button.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Configuration.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ConfigurationVersion.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Connector.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CoreResponseCode.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CustomAttribute.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataElement.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataSet.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Email.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ExternalUserInfo.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Feature.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/FeatureGroup.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/GlobalSetting.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Installation.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ListConfig.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Location.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Menu.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MenuItem.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileSession.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileUser.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Page.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/PasswordRuleSet.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Status.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ApplicationLoader.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ConnectionContext.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Constants.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Devices.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/DiskStorage.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Filters.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/JacksonRawValueModule.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/LoggingFilter.kt
[warn] Parameter 'featureID' is never used
[warn] Parameter 'featureID' is never used
[warn] Parameter 'featureID' is never used
[warn] Parameter 'groupID' is never used
[warn] Variable 'appAPIKey' is never used
[warn] Variable 'bodyJSON' is never used
[warn] Parameter 'userID' is never used
[warn] Parameter 'version' is never used
[warn] Parameter 'menuID' is never used
[warn] Parameter 'menuID' is never used
[warn] Parameter 'menuID' is never used
[warn] Unchecked cast: kotlin.Any! to T
[warn] Unchecked cast: kotlin.Any! to T
[warn] Variable 'result' is never used
[warn] Parameter 'context' is never used
[warn] Elvis operator (?:) always returns the left operand of non-nullable type ???
[info] Compiling 1 Scala source to /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/target/scala-2.11/classes...
Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js.
[info] Compiling 106 Kotlin sources
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/APIKeyCheckAction.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/Actions/VersionValidationAction.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/ConfigurationController.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Attachment.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Configurations.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataCollections.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/DataSets.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Lists.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Login.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Registration.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Router.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/client/Users.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Configurations.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/controllers/portal/Portal.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DatabaseExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/DateTimeExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/JsonExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/extensions/RequestExtensions.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Activity.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Application.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/AuthenticationInfo.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Branding.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Button.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Configuration.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ConfigurationVersion.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Connector.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CoreResponseCode.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/CustomAttribute.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataElement.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/DataSet.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Email.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ExternalUserInfo.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Feature.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/FeatureGroup.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/GlobalSetting.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Installation.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/ListConfig.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Location.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Menu.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MenuItem.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileSession.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/MobileUser.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Page.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/PasswordRuleSet.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/models/Status.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ApplicationLoader.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/ConnectionContext.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Constants.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Devices.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/DiskStorage.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/Filters.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/JacksonRawValueModule.kt
[warn] Duplicate source root: /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/app/utils/LoggingFilter.kt
[warn] Parameter 'featureID' is never used
[warn] Parameter 'featureID' is never used
[warn] Parameter 'featureID' is never used
[warn] Parameter 'groupID' is never used
[warn] Variable 'appAPIKey' is never used
[warn] Variable 'bodyJSON' is never used
[warn] Parameter 'userID' is never used
[warn] Parameter 'version' is never used
[warn] Parameter 'menuID' is never used
[warn] Parameter 'menuID' is never used
[warn] Parameter 'menuID' is never used
[warn] Unchecked cast: kotlin.Any! to T
[warn] Unchecked cast: kotlin.Any! to T
[warn] Variable 'result' is never used
[warn] Parameter 'context' is never used
[warn] Elvis operator (?:) always returns the left operand of non-nullable type ???
[info] Compiling 1 Scala source to /Users/matthew/Dropbox/ActiveProjects/AppTree/Server/AppTreeCore2/target/scala-2.11/classes...
[warn] application - Logger configuration in conf files is deprecated and has no effect. Use a logback configuration file instead.
[info] application - Creating Pool for datasource 'default'

Use embeddable version of Kotlin compiler

There are two Kotlin compiler distributions, both contain (not depend on!) a few libraries, most notably Google Guava. Due to this, when kotlin-plugin is added as a dependency alongside with other plugins which depend on different version of Guava, things break with hard-to-trace errors. Kotlin is aware of this and publishes embeddable version which relocates all baked dependencies into different package, thus fixing this problem.

Workaround is EDIT: would be to add this plugin with:

addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "0.9.2" exclude("org.jetbrains.kotlin", "kotlin-compiler"))

libraryDependencies += "org.jetbrains.kotlin" % "kotlin-compiler-embeddable" % "1.0.0-beta-2423"

which is not very clean. But the plugin uses some of the libraries which are relocated and breaks.

Adding -embeddable after kotlinLib("compiler in build.sbt and changing imports should be enough.

Problem with Kotlin 1.1.4-2

I use Kotlin 1.1.4-2 with kotlin-plugin v1.0.7, but following error occurs on compiling:

[error] Unable to find Args class
[error] (compile:kotlinCompile) Unable to find Args class

My build.sbt configuration is this:

name := "scala-reflection"
organization := "EPFL"
version := "0.1"
scalaVersion := "2.11.7"
/*resolvers += ScalaToolsSnapshots*/
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _)
//we are using virtual pattern matcher as it's seems to be the only way to have
//patterns workin with abstract types
scalacOptions ++= Seq("-deprecation", "-unchecked", "-Xexperimental", "-feature")

kotlinVersion := "1.1.4-2"
kotlincOptions += "-verbose"
kotlinLib("stdlib")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jre8
kotlinLib("stdlib-jre8")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect
kotlinLib("reflect")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-noarg
kotlinLib("noarg")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-test
kotlinLib("test")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-test-junit
kotlinLib("test-junit")
val listClasses = taskKey[Unit]("listClasses")
listClasses := {
  val classes = (classDirectory in Compile).value.***.get
  streams.value.log.info("classes: " + classes)
}

SBT 1.2.1 and NoSuchMethodError: sbt.package$.singleFileJsonFormatter()Lsjsonnew/JsonFormat

When using version 2.0.0 of this plugin in a play project that uses SBT 1.2.1 I'm unable to load and compile my project. Could it be because this kotlin-plugin is compiled with SBT 1.3 ? Is there a way around this besides upgrading SBT, we're kind of stuck on 1.2 for the moment.

Stack trace:

[info] Loading settings for project esignering-build from plugins.sbt,scan-plugins.sbt ...
[info] Loading project definition from C:\dev\ambita\esignering\project
[error] java.lang.NoSuchMethodError: sbt.package$.singleFileJsonFormatter()Lsjsonnew/JsonFormat;
[error]         at kotlin.Keys$.<init>(Keys.scala:19)
[error]         at kotlin.Keys$.<clinit>(Keys.scala)
[error]         at kotlin.KotlinPlugin$.<init>(KotlinPlugin.scala:71)
[error]         at kotlin.KotlinPlugin$.<clinit>(KotlinPlugin.scala)
[error]         at java.lang.Class.forName0(Native Method)
[error]         at java.lang.Class.forName(Class.java:348)
[error]         at sbt.internal.inc.ModuleUtilities$.getObject(ModuleUtilities.scala:20)
[error]         at sbt.internal.inc.ModuleUtilities$.getCheckedObject(ModuleUtilities.scala:27)
[error]         at sbt.internal.inc.ModuleUtilities$.$anonfun$getCheckedObjects$1(ModuleUtilities.scala:31)
[error]         at scala.collection.immutable.Stream.$anonfun$map$1(Stream.scala:415)
[error]         at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1169)
[error]         at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1159)
[error]         at scala.collection.generic.Growable.loop$1(Growable.scala:54)
[error]         at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:58)
[error]         at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:50)
[error]         at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:186)
[error]         at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:44)
[error]         at scala.collection.TraversableLike.$plus$plus(TraversableLike.scala:147)
[error]         at scala.collection.TraversableLike.$plus$plus$(TraversableLike.scala:143)
[error]         at scala.collection.immutable.List.$plus$plus(List.scala:207)
[error]         at sbt.internal.PluginDiscovery$.discoverAll(PluginDiscovery.scala:56)
[error]         at sbt.internal.Load$.loadPlugins(Load.scala:1318)

where is kotlin-plugin deployed?

I get UNRESOLVED DEPENDENCIES while trying to download the artifact.

My sbt looks as below,

name := "ParallelProgramming"

version := "1.0"

scalaVersion := "2.10.0"

libraryDependencies += "org.scala-lang" % "scala-library" % "2.10.0"
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "3.0.0" % "test"
libraryDependencies += "org.jetbrains.kotlin" % "kotlin-stdlib" % "1.1.51"

resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
resolvers += "Maven central" at "http://central.maven.org/maven2/"

And plugins.sbt

logLevel := Level.Warn                                                                                                                                 
                                                                                                       
addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "1.0.7") 

Error

[warn] 	module not found: com.hanhuy.sbt#kotlin-plugin;1.0.7
[warn] ==== typesafe-ivy-releases: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/com.hanhuy.sbt/kotlin-plugin/scala_2.10/sbt_0.13/1.0.7/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.hanhuy.sbt/kotlin-plugin/scala_2.10/sbt_0.13/1.0.7/ivys/ivy.xml
[warn] ==== local: tried
[warn]   /Users/a1353612/.ivy2/local/com.hanhuy.sbt/kotlin-plugin/scala_2.10/sbt_0.13/1.0.7/ivys/ivy.xml
[warn] ==== jcenter: tried
[warn]   https://jcenter.bintray.com/com/hanhuy/sbt/kotlin-plugin_2.10_0.13/1.0.7/kotlin-plugin-1.0.7.pom
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/hanhuy/sbt/kotlin-plugin_2.10_0.13/1.0.7/kotlin-plugin-1.0.7.pom
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: com.hanhuy.sbt#kotlin-plugin;1.0.7: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn] 	Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn] 		com.hanhuy.sbt:kotlin-plugin:1.0.7 (scalaVersion=2.10, sbtVersion=0.13)
[warn] 
[warn] 	Note: Unresolved dependencies path:
[warn] 		com.hanhuy.sbt:kotlin-plugin:1.0.7 (scalaVersion=2.10, sbtVersion=0.13) (/Users/a1353612/buybest/sc212/parallel-programming/2-data-parallelism_fork_join/ParallelSum/project/plugins.sbt#L3-4)
[warn] 		  +- default:parallelsum-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: com.hanhuy.sbt#kotlin-plugin;1.0.7: not found
	at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:294)
	at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:191)
	at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:168)
	at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
	at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
	at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
	at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
	at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
	at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
	at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
	at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
	at xsbt.boot.Using$.withResource(Using.scala:10)
	at xsbt.boot.Using$.apply(Using.scala:9)
	at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
	at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
	at xsbt.boot.Locks$.apply0(Locks.scala:31)
	at xsbt.boot.Locks$.apply(Locks.scala:28)
	at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
	at sbt.IvySbt.withIvy(Ivy.scala:127)
	at sbt.IvySbt.withIvy(Ivy.scala:124)
	at sbt.IvySbt$Module.withModule(Ivy.scala:155)
	at sbt.IvyActions$.updateEither(IvyActions.scala:168)
	at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1392)
	at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1388)
	at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1422)
	at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$90.apply(Defaults.scala:1420)
	at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
	at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1425)
	at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1419)
	at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
	at sbt.Classpaths$.cachedUpdate(Defaults.scala:1442)
	at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1371)
	at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1325)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:235)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[error] (*:update) sbt.ResolveException: unresolved dependency: com.hanhuy.sbt#kotlin-plugin;1.0.7: not found

Cannot use with Kotlin 1.2.x

Hi there. It seems that I am unable to compile projects when using Kotlin 1.2. Here's the error:

`[info] Compiling 119 Kotlin sources
java.lang.NoSuchFieldException: freeArgs
	at java.lang.Class.getField(Class.java:1703)
	at kotlin.KotlinStub$$anon$1.updateDynamic(KotlinCompile.scala:173)
	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:497)
	at kotlin.KotlinCompile$.compile(KotlinCompile.scala:54)
	at kotlin.KotlinPlugin$$anonfun$5.apply(KotlinPlugin.scala:65)
	at kotlin.KotlinPlugin$$anonfun$5.apply(KotlinPlugin.scala:64)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] (compile:kotlinCompile) java.lang.NoSuchFieldException: freeArgs`

Any idea how to fix it? I need to deploy one of my projects soon and would like to do this using 1.2.x due to some features not available prior to that version.

Kotlin Controllers are not able to resolve Twirl templates

I started with a very simple Play application which has a Controller in Kotlin that references a Twirl template. The Twirl needs to be complied before the Kotlin so that the generated class is visible, but the Kotlin appears to be compiled first resulting in errors:

[info] Compiling 2 Kotlin sources
[error] /Users/apowell/dev/kotlin-play-poc/app/controllers/HomeController.kt: 6, 19: Unresolved reference: index
[error] /Users/apowell/dev/kotlin-play-poc/app/controllers/HomeController.kt: 11, 27: Unresolved reference: index
[error] Compilation failed. See log for more details
[error] (compile:kotlinCompile) Compilation failed. See log for more details

My Controller is:

package controllers

import play.mvc.Controller
import play.mvc.Result
import play.mvc.Results
import views.html.index

class HomeController : Controller() {

    fun home(): Result {
        return Results.ok(index.apply("Your new application is ready"))
    }
}

If I remove the reference to the Twirl template (eg: return Results.ok("Kotlin controller is working")) then the compilation is successful, Java controllers can reference this template and the application runs.

Is there a way to force the Twirl/scala compilation to happen first?

sbt run / working example in the readme

I'm trying to get a trivial/helloworld setup for kotlin code using sbt and this plugin.

project/plugins.sbt: "addSbtPlugin("com.hanhuy.sbt" % "kotlin-plugin" % "1.0.3")"
build.sbt: kotlinLib("stdlib")
src/main/kotlin: fun main(args: Array<String>) {  println("Hello, world!") }

Things appear to go well until 'run' -> No main class detected

$ sbt run
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
[info] Loading project definition from /home/donp/code/vault/plutus-kotlin/project
[info] Set current project to plutus (in build file:/home/donp/code/vault/plutus-kotlin/)
[info] Compiling 1 Kotlin source
java.lang.RuntimeException: No main class detected.
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) No main class detected.
[error] Total time: 3 s, completed May 24, 2016 2:20:52 PM

I'm new to Kotlin, so can you point out what is missing, and whatever it is, add something in the README for kotlin newbies?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.