我对Maven pom.xml的配置不太满意。
对于一个Corda(区块链)Bootcamp示例,我试图将Eclipse项目配置为与Java和Kotlin一起使用,但是我面临以下错误消息:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'plugin'.
One of '{
"http://maven.apache.org/POM/4.0.0":parent,
"http://maven.apache.org/POM/4.0.0":packaging,
"http://maven.apache.org/POM/4.0.0":name,
"http://maven.apache.org/POM/4.0.0":description,
"http://maven.apache.org/POM/4.0.0":url,
"http://maven.apache.org/POM/4.0.0":prerequisites,
"http://maven.apache.org/POM/4.0.0":issueManagement,
"http://maven.apache.org/POM/4.0.0":ciManagement,
"http://maven.apache.org/POM/4.0.0":inceptionYear,
"http://maven.apache.org/POM/4.0.0":mailingLists,
"http://maven.apache.org/POM/4.0.0":developers,
"http://maven.apache.org/POM/4.0.0":contributors,
"http://maven.apache.org/POM/4.0.0":licenses,
"http://maven.apache.org/POM/4.0.0":scm,
"http://maven.apache.org/POM/4.0.0":organization,
"http://maven.apache.org/POM/4.0.0":profiles,
"http://maven.apache.org/POM/4.0.0":modules,
"http://maven.apache.org/POM/4.0.0":repositories,
"http://maven.apache.org/POM/4.0.0":pluginRepositories,
"http://maven.apache.org/POM/4.0.0":dependencies,
"http://maven.apache.org/POM/4.0.0":reports,
"http://maven.apache.org/POM/4.0.0":reporting,
"http://maven.apache.org/POM/4.0.0":dependencyManagement,
"http://maven.apache.org/POM/4.0.0":distributionManagement
}' is expected.
这里是整个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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>r3</groupId>
<artifactId>CordaAppBootCamp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<kotlin.version>1.2.51</kotlin.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</project>
我在做什么错了?
在Baeldung的这篇帖子中,我是这样做的:
https://www.baeldung.com/kotlin-maven-java-project
它还有更多问题消息。
我通过使用<pluginManagement>
标签
答案 0 :(得分:0)
看看Bootcamp cordapp的较新版本,gradle现在可以为您处理所有这些操作,因此您无需自己担心依赖项。
https://github.com/corda/bootcamp-cordapp
作为另一个说明,推荐的IDE实际上是IntelliJ IDEA,并且不再黯然失色。 (来源:https://docs.corda.net/docs/corda-os/4.4/getting-set-up.html)