Tag: maven

Kotlin + Maven组装:没有主要的清单属性

我有问题使用Maven将Kotlin项目与一些依赖关系组合到JAR文件中。 我如何将项目组装到JAR中: RightPanel -> MavenProjects -> Lifecycle -> package -> run 当我运行JAR文件时: java -jar path.jar 我得到以下错误: no main manifest attribute, in path.jar 我已经添加了像这样的maven-assembly-plugin : 所以我的插件目录看起来像这样: <build> <sourceDirectory>src/main/kotlin</sourceDirectory> <testSourceDirectory>src/test/kotlin</testSourceDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <archive> <manifest> <mainClass>${main.class}</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.jetbrains.kotlin</groupId> […]

我想将我的kotlin版本添加到gradel项目中

当我在kotlin中创建一个新的gradel项目并在我的项目级别gradel中添加maven {url“ https://dl.bintary.com/kotlin/kotlin-eap-1.1 ”}这个url并下载zip文件后,我是选择工具工具窗口-gradel …并试图添加一个zip文件,然后它不添加…这么简单,我只是想添加我的kotlin版本到该gradel窗口,以便我能够运行该gradle项目请记住我对这个kotlin语言很新,所以我不知道这个。

Gradle无法解析kotlin gradle插件1.1.1 – InvalidAlgorithmParameterException

我最近将Kotlin 1.1.1添加到了我的项目中,该项目在OS X上运行良好。我将它同步到一个Ubuntu框中,并试图对我的构建结果运行任何gradle命令: A problem occurred configuring root project 'myproject'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.1. Required by: project : > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.1. > Could not get resource 'https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.1/kotlin-gradle-plugin-1.1.1.pom'. > Could not HEAD 'https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.1.1/kotlin-gradle-plugin-1.1.1.pom'. > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty […]

Kotlin – Maven不执行测试

所以我有一个我想测试的Kotlin应用程序。 我的测试( .kt )文件,在Eclipse中成功执行。 (测试本身是一个h2 mock jdbc测试)。 现在当运行mvn test -X它说: releases: [enabled => true, update => never] ] [DEBUG] (s) reportFormat = brief [DEBUG] (s) reportsDirectory = C:\Users\Ivar\workspace\anotherworkspace\newrestservice\complete\target\surefire-reports [DEBUG] (f) rerunFailingTestsCount = 0 [DEBUG] (f) reuseForks = true [DEBUG] (s) runOrder = filesystem [DEBUG] (f) shutdown = testset [DEBUG] (s) skip = false [DEBUG] (f) […]

创建和发布Kotlin库以避免多个运行时问题的正确方法是什么?

我有一个Kotlin库,我想发布到Maven仓库,并在其他应用程序中使用。 但是,当我把它作为依赖(到pom.xml )在我的Kotlin应用程序中添加时,我得到这个警告: [WARNING] Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath or use '-Xskip-runtime-version-check' to suppress this warning [WARNING] ………mylib.jar: (-1, […]

如果在Kotlin Maven插件中为空,则跳过

我们已经在我们最顶级的项目POM中启用了Kotlin Maven插件,如下所示: <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> <version>${kotlin.version}</version> <executions> <execution> <id>compile</id> <phase>process-sources</phase> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile</id> <phase>process-test-sources</phase> <goals> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> ATM,本项目中只有少数模块有Kotlin源代码。 (该项目大约有50个模块。)这个想法是,大多数最终将有Kotlin代码,我们不希望每个项目的基础上联系起来。 我们想配置一次,忘记它。 这个工作除了我们得到这个警告在大多数模块的构建: [INFO] Kotlin Compiler version 1.0.2 [WARNING] No sources found skipping Kotlin compile 我们在JAR插件中也遇到了这个问题。 该插件有一个配置选项,可以让我们这样做: <configuration> <skipIfEmpty>true</skipIfEmpty> </configuration> 这个插件的类似的警告关闭。 Kotlin编译器插件似乎没有任何这样的配置选项。 所以,我的问题是: 有没有我们忽略的配置选项? 我们是否应该以不同的方式配置Kotlin编译器插件以避免此警告? TIA!

如何将kotlin-js-library更新为1.1.3,就像kotlin-gradle-plugin一样?

如果你看: https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/ 目前的版本是1.1.3,但是: https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-js-library/ 回到1.0.7。 我怎样才能触发这个更新?

如何使用Maven编译Java + Kotlin项目?

我试图编译有Kotlin类引用Java类的Maven项目。 这是我父母POM的一部分: … <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>${kotlin.version}</version> </dependency> … <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>${compiler-plugin-version}</version> <configuration> <source>${java-version}</source> <target>${java-version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> <version>${kotlin.plugin.version}</version> <executions> <execution> <id>compile</id> <phase>process-sources</phase> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile</id> <phase>process-test-sources</phase> <goals> <goal>test-compile</goal> </goals> </execution> </executions> <configuration> <scanForAnnotations>false</scanForAnnotations> </configuration> </plugin> 和POM的相关部分: <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> </dependency> … <plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> <configuration> <sourceDirs> <source>${project.basedir}/src/main/kotlin</source> […]

混合Kotlin + Java与Maven,未解决的参考

我有一个Maven项目与Kotlin代码hello.kt调用Java代码JavaFoo.java调用Kotlin代码KotlinFoo.kt 。 hello.kt也直接调用KotlinFoo.kt 。 我试图用mvn clean install使用kotlinlang的Maven文档中描述的Maven设置来构建它。 如果hello.kt不调用JavaFoo (但是我把JavaFoo留在了项目中),那么这样做就好了。 文档中说,应该在Java编译器之前调用Kotlin编译器,这意味着所有的Kotlin代码都需要在任何Java代码之前编译,即使用这种设置,您可以从Java调用Kotlin,反之则不然。 但是,文档将这种设置描述为“混合代码应用程序”,而不是“从Java调用Kotlin”。 换句话说,这种失败似乎与文件似乎暗示的一致,但与他们直接说的不一致 – 或者我只是误解了一些东西。 我想从另一个语言中调用每种语言。 有没有一个Maven的配置,将这样做,请? (我查看了混合代码设置的各种StackExchange问​​题,而且这些解决方案都不适用于我。) 按要求添加代码:pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.kotlindemo</groupId> <artifactId>kotlin-demo</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>kotlin-demo</name> <properties> <kotlin.version>1.1.2-2</kotlin.version> <kotlin.compiler.incremental>true</kotlin.compiler.incremental> <main.class>com.example.kotlindemo.HelloKt</main.class> </properties> <dependencies> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>${kotlin.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> <version>${kotlin.version}</version> <executions> <execution> <id>compile</id> <phase>process-sources</phase> <goals> <goal>compile</goal> </goals> <configuration> […]

Kotlin Kapt:java.lang.IllegalStateException:endPosTable已经设置

试图使用Kotlin maven插件来构建一个kotlin应用程序。 使用Dagger 2依赖注入框架。 调用时出现以下错误 mvn clean compile package 也可以通过调用来复制 mvn clean package 然后打电话 mvn package 在maven 3和java 8中似乎有一个错误,但是我找不到kotlin maven插件的解决方法。 [ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.1.3-2:kapt (kapt) on project process: Compilation failure [ERROR] java.lang.IllegalStateException: failed to analyze: java.lang.IllegalStateException: endPosTable already set [ERROR] at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57) [ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.kt:344) [ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileBunchOfSources(KotlinToJVMBytecodeCompiler.kt:226) [ERROR] at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:200) [ERROR] at […]