Tag: maven

为什么这个Spring Boot应用程序找不到主页面?

我试图创建一个最小的Spring Boot应用程序,允许我在前端使用ReactJS。 我想实现的 当我运行Spring Boot应用程序时,它应该显示一个包含React组件的页面。 项目的结构 你可以在这里找到源代码。 Spring Boot应用程序类 控制器类 主HTML页面 反应代码 我得到了什么 当我 运行mvn clean mvn clean spring-boot:run`和 导航到http://localhost:8080 , 我得到了404错误(见下文)。 我该如何解决? 笔记: 我从教程React.js和Spring Data REST中复制了这个方法。 不要告诉我摆脱Kotlin,它是不太可能是Kotlin导致的问题。 更新1(07.08.2017 22:17 MSK): mvn clean spring-boot:run的输出可以在这里找到。 更新2(07.08.2017 22:44 MSK): 在MyApp类RestController更改为Controller并将main方法移到里面并没有帮助。 目前, MyApp类看起来像这样: @SpringBootApplication @Controller open class MyApp { fun main(args: Array<String>) { SpringApplication.run(MyApp::class.java,*args) } }

Python中的PIP风格的本地Java包管理系统?

我想用Java或其他JVM语言(如Scala,Kotlin或Groovy)进行编程。 当我在我的项目上编程时,我只想在我的Java / Scala / Kotlin源文件中导入语句,而无需在Gradle / Maven构建脚本中再次声明这些包。 相反,我想要像在Python中那样工作,即在我的源文件的开头有我的导入语句,我就完成了。 如果所有软件包都安装在本地中央软件包管理系统中,或者得到一个错误消息,告诉我必须安装缺少的软件包,那么在编译时应该自动包含这些软件包。 它应该基本上和Python和PIP一样工作。 像Groovy或Maven这样的工作流是可能的吗? 提前致谢!

在Java中使用Kotlin类:找不到符号

我已经找到了关于Android的这个类似的问题,但我使用普通的Java和Maven作为构建工具。 我认为最好发表一个新的问题。 我创建了一个Kotlin类,我试图从Java类MyKotlinClass.class 。 Maven构建失败,而IntelliJ Idea中的编译工作正常。 我已经将Kotlin插件添加到maven: <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> <version>${kotlin.version}</version> <executions> <execution> <id>compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile</id> <phase>test-compile</phase> <goals> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> 但是这并没有帮助: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project app: Compilation failure [ERROR] MyClassLinkingKotlin.java:[100,40] error: cannot find symbol 行/列恰好引用符号MyKotlinClass.class 。 即使是这样使用也会失败: System.err.println(MyKotlinClass.class)

Maven发布gradle插件跳过版本

我有gradle多模块项目配置kotlin脚本。 我想添加发布到Maven仓库,我发现它的maven-publish插件。 但它似乎跳过了为每个项目配置的版本: MyProject/build.gradle.kts : subprojects { apply { plugin("maven-publish") } configure<PublishingExtension>() { publications { repositories { … } create<MavenPublication>("myPublication") { from(components.getByName("java")) logger.lifecycle("test: ${project.group} ${project.name} ${project.version}") } } MyProject/subproject1/build.gradle.kts : version = "1.0.0-SNAPSHOT" gradle publish输出: test: my.project subproject1 unspecified artifact file does not exist: '…/MyProject/subproject1/build/libs/subproject1.jar' 文件subproject1.jar不存在,但subproject1-1.0.0-SNAPSHOT.jar会。 如何使gradle得到正确版本的模块?

如何使用Maven运行Spek测试?

我试图用Maven运行Spek测试。 我已经设置了这样的maven: <build> <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory> <plugins> <plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> <version>${kotlin.version}</version> <configuration/> <executions> <execution> <id>compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile</id> <phase>test-compile</phase> <goals> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 另外我在src / test / kotlin有一些Spek测试。 我可以在IDE中运行这些,但是当我运行mvn test它们完全被surefire插件忽略(它报告0个正在运行的测试)。 是否有可能与Maven运行Spek测试,如果是这样,将如何设置? 我在spek主页上找不到任何关于它的信息。

如何指定maven编译器插件的顺序

我正在使用maven开发一个混合的java和kotlin项目。 我现在面临的问题是, maven-compiler-plugin在编译kotlin-maven-plugin之前运行。 [INFO] — maven-compiler-plugin:3.0:compile (default-compile) @annotation — [INFO] Changes detected – recompiling the module! [INFO] Compiling 11 source files to /Users/hannes/workspace/tikxml/annotation/target/classes [INFO] — kotlin-maven-plugin:1.0.0-beta-4583:compile (compile) @ annotation [INFO] Kotlin Compiler version 1.0.0-beta-4583 在我的java源代码中,我引用了用kotlin编写的类。 但是javac在kotlinc之前运行。 因此,maven中断与编译器错误。 我的POM(父POM,我使用子模块)看起来像这样: <?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.sonatype.oss</groupId> <artifactId>oss-parent</artifactId> <version>7</version> </parent> … <modules> <module>core</module> […]

Gradle不会导入bintray依赖项,但不会引发任何错误

我正在创建一个使用Kotlin的Squash SQL库的项目。 我已经添加了依赖到我的build.gradle文件。 运行更新时,只需完成而不输出任何错误。 但图书馆没有得到我的项目导入,并没有出现。 IntelliJ中显示的依赖关系: 我的build.gradle文件: //Kotlin Stuff, nothing changed here repositories { mavenCentral() maven { url "http://dl.bintray.com/kotlin/squash" } } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" testCompile group: 'junit', name: 'junit', version: '4.12' compile 'org.jetbrains.squash:squash:0.2.2' } //Kotlin Stuff

Bintray依赖不会在InteliJ下载

我在InteliJ 2017.1中创建了一个简单的kotlin项目 我想添加依赖到这个库的初学者: https : //github.com/JetBrains/Exposed 我添加了maven框架,并编辑了pom.xml,如下所示。 为简单起见,我删除了kotlin配置条目。 <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <repositories> <repository> <id>exposed</id> <name>exposed</name> <url>https://dl.bintray.com/kotlin/exposed</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.jetbrains.exposed</groupId> <artifactId>exposed</artifactId> <version>0.7.6</version> <type>pom</type> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib-jre8</artifactId> <version>${kotlin.version}</version> </dependency> </dependencies> </project> Kotlin库被下载了,我在外部库中看到它们。 不幸的是,这不是暴露的情况。 我错过了什么?

为什么IntelliJ Idea不能从另一个Kotlin模块中找到Maven依赖关系?

想象一下,我有两个使用Kotlin代码的基于Maven的项目, prjA和prjB 。 prjA中的测试类SomeTest引用了prjB中定义的类和函数 : class SomeTest { @Test fun prjACanReferencePrjBStuff() { val valRes = ValidationResult() val correctValRes = createCorrectValidationResult() } } 当我 在prjB中运行mvn clean install , 在IntelliJ Idea和更新prjA的依赖关系 在prjA中运行mvn clean install , 我得到错误 – Maven找不到在prjB定义的类: 为什么? 我该如何解决? 笔记: Kotlin类默认是公开可见的。 在mvn install prjB期间,我没有得到任何错误。 Maven仓库包含prjB工件和IntelliJ Idea引用正确的Maven仓库。 当我尝试从命令行构建prjA ,构建成功。 使IntelliJ Idea缓存无效并重建项目无济于事。 更新1:我需要一个解决方案,它允许我不仅在测试中使用prjB 。 更新2:如果我用Java中的prjB重写Kotlin类,那么一切都很好。

尝试在Kotlin和Spring引导下使用JPA时出现BeanDefinitionParsingException

当我尝试使用springboot + JPA + kotlin + maven时,我得到这个异常 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Bean method 'init' must not be private or final; change the method's modifiers to continue Offending resource: com.wirecard.kotlin.jpa.Application at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) at org.springframework.context.annotation.BeanMethod.validate(BeanMethod.java:50) at org.springframework.context.annotation.ConfigurationClass.validate(ConfigurationClass.java:219) at org.springframework.context.annotation.ConfigurationClassParser.validate(ConfigurationClassParser.java:528) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:307) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) at […]