我有一个使用kotlin编程语言的maven spring-boot项目。我的主要pom构建部分如下所示:
<build>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration>
<compilerPlugins>
<plugin>spring</plugin>
<plugin>no-arg</plugin>
<plugin>jpa</plugin>
</compilerPlugins>
</configuration>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>/src/main/kotlin</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${query-dsl.version}</version>
<classifier>jpa</classifier>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<source>src/main/kotlin</source>
<source>src/main/resources</source>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<source>src/test/kotlin</source>
<source>src/test/groovy</source>
<source>src/test/resources</source>
</sourceDirs>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-noarg</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${query-dsl.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>${gmavenplus-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
<includes>
<include>**/*Spec*.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
当我在Windows 10(MVN全新安装)上构建项目时,它可以正常工作。但是,当我尝试在ubuntu 16.04上执行相同操作时,它失败并显示错误消息:
2019-01-23T10:48:08.4203167Z [INFO] Reactor Summary:
2019-01-23T10:48:08.4204750Z [INFO]
2019-01-23T10:48:08.4213364Z [INFO] parkandrest 0.0.1-SNAPSHOT ......................... SUCCESS [ 10.617 s]
2019-01-23T10:48:08.4218748Z [INFO] exception-api ...................................... SUCCESS [ 9.640 s]
2019-01-23T10:48:08.4224367Z [INFO] parkingmanagement-api .............................. SUCCESS [ 2.429 s]
2019-01-23T10:48:08.4229095Z [INFO] timemanagement ..................................... SUCCESS [ 5.083 s]
2019-01-23T10:48:08.4235096Z [INFO] parkingmanagement-core ............................. FAILURE [ 7.576 s]
2019-01-23T10:48:08.4239063Z [INFO] parkingmanagement-web .............................. SKIPPED
2019-01-23T10:48:08.4243146Z [INFO] security-api ....................................... SKIPPED
2019-01-23T10:48:08.4247402Z [INFO] security-core ...................................... SKIPPED
2019-01-23T10:48:08.4251894Z [INFO] database ........................................... SKIPPED
2019-01-23T10:48:08.4256392Z [INFO] security-web ....................................... SKIPPED
2019-01-23T10:48:08.4260944Z [INFO] timemanagement-web 0.0.1-SNAPSHOT .................. SKIPPED
2019-01-23T10:48:08.4265825Z [INFO] ------------------------------------------------------------------------
2019-01-23T10:48:08.4268080Z [INFO] BUILD FAILURE
2019-01-23T10:48:08.4272856Z [INFO] ------------------------------------------------------------------------
2019-01-23T10:48:08.4275917Z [INFO] Total time: 42.552 s
2019-01-23T10:48:08.4280062Z [INFO] Finished at: 2019-01-23T10:48:08Z
2019-01-23T10:48:08.4284910Z [INFO] ------------------------------------------------------------------------
2019-01-23T10:48:08.4305145Z [ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.11:compile (compile) on project parkingmanagement-core: Compilation failure
2019-01-23T10:48:08.4309787Z [ERROR] /home/vsts/work/1/s/parkingmanagement-core/src/main/kotlin/parkandrest/parkingmanagement/core/parking/space/ParkingSpaceViewSpecification.kt:[11,33] Unresolved reference: QParkingSpaceView
2019-01-23T10:48:08.4312142Z [ERROR]
如果有兴趣的人,可以在GitHub上查看完整的项目